Wow! I'm absolutely thrilled with the results of this video - I've been experimenting with my ESP 320x Spectrum board and its touch Matrix keyboard. Had a bit of trouble with combined button inputs, so I took a deep dive into how touch works and discovered these old, but gold, ICs. After some testing, they turned out to be a perfect solution to my multiplexing problem! I then got a new board design shipped from PCB way - looks awesome and it didn't break the bank. Can't believe how responsive the keyboard is! Got the 'Hello World' program up and running, and even played Manic Miner. The final board's all set - can't wait to get this on sale! And keep watching because I've got some interesting plans for this expansion port!
[0:00] it actually works that’s
[0:04] amazing so I got a small problem this is
[0:08] my ESP 320x Spectrum board with its um
[0:11] touch Matrix keyboard so it’s using 13
[0:13] touch pins and we’re multiplexing those
[0:16] across the keyboard and it works really
[0:18] well um so I can give you a quick demo
[0:19] here so we go into basic can do 10 print
[0:23] and here we hit a problem so if I try
[0:25] and do symbol shift and P to get the
[0:27] double quote marks you can see we got a
[0:29] weird combination
[0:30] characters we can’t do combined buttons
[0:33] so delete kind of works because it’s on
[0:35] different characters if we try and go
[0:37] into extended mode then we can’t do that
[0:39] either we get all sorts of weird
[0:41] characters coming out it’s basically it
[0:43] works as long as you only do individual
[0:45] characters now I can work around this by
[0:48] using sticky keys so I can make it so
[0:50] that symbol shift sticks on and then you
[0:52] can do p to get quote marks but it’s not
[0:54] ideal I need a bit of a solution so
[0:56] let’s do some experiments
[1:01] so just how does this touch stuff work
[1:02] anyway well what I’ve done is I’ve
[1:04] hooked up a touch pin to my oscilloscope
[1:07] it’s extremely sensitive so I just need
[1:08] to move close to the touch pin and it
[1:10] lights up uh we just wide up to the RGB
[1:12] LED here and if we look at the trace on
[1:14] the oscilloscope when I’m moving close
[1:17] you can see it seems to expand slightly
[1:19] so this regularly repeated pattern is
[1:21] what the esp32 is sending out over the
[1:23] touch pin and it’s basically if we zoom
[1:25] in we can see it’s just a sore too now
[1:30] when I move close to the pin you can see
[1:32] how that expands out so what the esp32
[1:34] does is it times how long it takes for
[1:37] the pad to charge up and down between
[1:39] two certain voltages and it uses that to
[1:41] determine if something’s touching it
[1:43] because the capacitance changes based on
[1:45] is somewhere near or far away so when
[1:48] we’re close there’s more capacitance so
[1:50] it takes longer to charge up and down
[1:52] and when we’re not touching the
[1:53] capacitance goes down and it takes the
[1:55] same amount of time to charge and
[1:56] discharge so it’s really just an analog
[1:58] signal so what I was thinking is I found
[2:01] these nice ic’s they’ve been around for
[2:04] absolutely ever so they’re cheap as
[2:06] chips and there’s multiple manufacturers
[2:08] who make them so what we should be able
[2:10] to do is Multiplex our touch pins now we
[2:13] can Multiplex one pin out to eight touch
[2:16] pins so if I’ve got five of these chips
[2:19] that will give me 40 touch pads which
[2:21] would be one touch pad for each IND
[2:23] individual key of the spectrum keyboard
[2:25] now the only thing is there is an on
[2:27] resistance of this multiplexer so what
[2:29] want to check is does the touch still
[2:31] work when you run it through a resistor
[2:34] so what I’ll do is I’ll just stick my
[2:37] touch pin in there and I’ve got a 270
[2:39] Ohm resistor so let’s stick that in
[2:43] there now let’s see if I touch it it
[2:47] still works so that’s pretty promising
[2:49] so these multiplexor ic’s might be the
[2:51] solution to my
[2:55] problem so I’ve ordered a bunch of these
[2:58] um ic’s and I’ve w add one up so what
[3:01] I’ve got here is I’ve got eight normal
[3:04] GPI op pins just drive some LEDs to
[3:07] indicate if something’s been touched
[3:09] I’ve got this one touch pin going into a
[3:11] multiplexer and I’ve got three address
[3:13] lines so in theory if this works
[3:16] touching these little pads should
[3:19] indicate a touch and it actually works
[3:23] that’s amazing so I can touch multiple
[3:26] pads and I can detect them individually
[3:29] so that’s working amazingly well so I’ve
[3:33] got just one touchpad multiplexing out
[3:36] to eight different inputs so 1 2 3 4 5 6
[3:39] seven seven eight and I can touch them
[3:42] all at the same time and I can detect it
[3:44] and I can detect them individually so
[3:47] this should solve my Spectrum keyboard
[3:50] issue so it’s time to jump into key Cad
[3:52] and get this designed up cuz I think
[3:55] this is going to work amazingly well I’m
[3:58] really pleased that that’s incredible
[4:01] but first time amazing one eternity
[4:05] later so I’m not going to force you to
[4:06] watch a whole bunch of keycard messing
[4:09] around but um here’s our new ic’s so we
[4:12] got one two three four five Multiplex of
[4:15] ic’s so each of these take one touch pin
[4:17] so we have five touch pins and each
[4:19] touch pin is being multiplexed out to
[4:21] eight touch pads so we have 5times 8
[4:23] which is our 40 Spectrum keys so here’s
[4:26] all the keys here we individual bits
[4:28] going to the the um
[4:30] multiplexes uh if we look on the PCB
[4:34] this uh was quite a pain to root but I
[4:36] did manage to root it on two um two
[4:39] layers so that’s pretty good for for a
[4:40] while I was um switching to four layers
[4:42] thinking I’d need to do that but I
[4:44] managed to root it on just two layers
[4:46] and is it rooting or routing routing
[4:48] rooting let me know in the comments
[4:50] rooting or routing which is it when it
[4:51] comes to pcbs so here’s our five ic’s
[4:54] that do the multiplexing there’s a few
[4:56] other changes on the board so there’s
[4:57] new SD card um socket this one’s a lot
[5:00] cheaper than the one I was using so
[5:01] we’ve saved a bit of bomb costs um some
[5:04] new buttons these are now side buttons
[5:06] rather than top buttons got an onoff
[5:09] switch um and we have our expansion Port
[5:12] so I’m really excited about this
[5:14] expansion Port I think we might have to
[5:15] do something quite interesting with this
[5:17] but uh that will be for a future video
[5:19] and we have the two connectors for the
[5:21] displays so I’ve got two displays I’m
[5:23] looking at one of them has 18 pins and
[5:26] the other one has I think that’s 10 pins
[5:29] and these are also rooted out to the um
[5:31] expansion Port so that’s going to be
[5:33] quite interesting um so yeah so need to
[5:37] get this sent off to PCB way now and uh
[5:40] hopefully I’ve not made any mistakes
[5:41] I’ve double checked everything I think
[5:43] it’s correct um everything looks right
[5:45] schematic match is all the DLCs are
[5:47] right so fingers crossed I’ve not messed
[5:49] it
[5:51] [Music]
[5:52] up so the uh new boards have arrived
[5:55] from PCB way and I have to say they look
[5:58] absolutely fantastic so here’s our new
[6:00] um ic’s that do all the attouch
[6:02] multiplexing they worked out so cheap
[6:04] it’s incredible I think I got these for
[6:06] 20 cents a piece um so that’s amazing
[6:09] doesn’t add much to the bomb at all now
[6:11] um it’s the PCB way 10th anniversary so
[6:14] if you want some pcbs you should go over
[6:16] and check them out they are really great
[6:18] I can recommend them I mean they’ve made
[6:19] this what more can you ask for so let’s
[6:21] test out the actual keyboard so let’s
[6:24] have a look go into basic and let’s try
[6:27] and WR something so let’s do the old
[6:29] hello world
[6:30] so now I should be able to use symbol
[6:31] shift and P to get quotes and that
[6:34] actually works and I can shift and zero
[6:37] for delete
[6:39] hello world uh symbol shift p and then
[6:44] symbol shift o for a um oh let’s put a
[6:47] space in space symbol shift B symbol
[6:50] shift o it’s working brilliantly um this
[6:52] is absolutely
[6:54] amazing there we go hello world oops
[6:57] hello world 10 looks like I can’t basic
[7:00] anymore print 10 so let’s see how do we
[7:02] do edit uh so that’s one
[7:07] no edit there we go cool it’s coming
[7:10] back to me so go to 10 enter run there
[7:15] we go hello world it works let’s try a
[7:18] quick
[7:19] game okay manic
[7:26] Miner so the keyboard’s really
[7:28] responsive as well even though we’re
[7:30] having to scan it it’s still amazingly
[7:32] good so this is brilliant I think we’re
[7:34] actually pretty close to a production
[7:36] version so I’m going to get on and uh
[7:38] finish this off and then try and get
[7:40] this on sale um I think um oops not very
[7:44] good at manic Miner anymore but uh yeah
[7:46] so I’m going to try and get this on sale
[7:48] as soon as possible I think we’re pretty
[7:49] good to go um the display all works and
[7:52] the display is pretty nice it’s quite
[7:53] big um and I’ve got a few ideas for this
[7:56] expansion Port but that will be in a
[7:58] future video so thanks for watching it
[8:01] works and it’s fantastic