Learning the Art of Electronics - keypad - Page 1
Forum section: electronics / beginners

author: David1
author_rank: Contributor
timestamp: May 05, 2018, 04:28:13 pm
content: Has anyone found ordering information or the schematic referred to on Page 620 of Learning the Art of Electronics?Page 620 of LAoE says, "The keypad is not a standard commercial part. See Appendix E for ordering information and Appendix 14N.20 for the schematic, in case you want to build your own."However, Appendix E doesn't mention the keypad. The digital parts list on the LAoE website (link below) says, "See LAoE website" but there the trail goes cold; the website gives details for ordering the LCD but not the keypad (as far as I can see).Also, Appendix 14N.20 doesn't seem to exist, nor the schematic for the keypad.So the questions are:Has anyone found ordering information for the LAoE keypad?Has anyone found Appendix 14N.20 or the schematic for the keypad?Can anyone suggest an alternative approach to providing the keypad functionality which includes: controlling lines D4 to D14 of an XC9572XL counter; and writing 8 bit values to RAM via a 74HC541 octal 3-state buffer.https://learningtheartofelectronics.com/parts-lists/parts-lists/

author: rstofer
author_rank: Super Contributor
timestamp: May 05, 2018, 08:51:59 pm
content: There was another thread on this last week:https://www.eevblog.com/forum/projects/has-anyone-built-the-dallas-breadboard-computer-from-art-of-electronics/msg1503499/#msg1503499For the price, I am betting that the display comes with whatever is needed including the keypad.Just to make things difficult, the project uses a PAL device (Programmable Array Logic) which will be problematic for a newcomer. These need to be programmed and many take a special device to do the programming.Later on, the digital section settles down to basically a course on the 8051 chip which is archaic but still used. I might consider looking through the sections and seeing if a commercial 8051 trainer wouldn't work just as well.https://www.ebay.com/itm/8051-Microcontroller-Kit/282939936088?hash=item41e088cd58:g:SjwAAOSwXeJXeMWTNote that I haven't read through that section of the manual so I have no idea what is going to be presented. But scanning through the next 50 pages or so, they use that keyboard/display a lot.There are so many other ways to learn about digital systems, I think, personally, I would give theirs a pass. Or, I would buy or reinvent their display/keyboard and then try to figure out what the Dallas "Big Board" brought to the dance.Or, if I really wanted to learn about computer design down in the dirt with the flops and gates, I would Google for the LC3 project. This presents an entire RISC processor design from scratch. The project comes with an assembler and C compiler so it may be useful upon completion. It will be a modest project in terms of FPGAs but a major step along the educational path.There is a book:https://www.amazon.com/Introduction-Computing-Systems-Gates-Beyond/dp/0072467509/ref=sr_1_1

author: rstofer
author_rank: Super Contributor
timestamp: May 05, 2018, 09:13:24 pm
content: Don't overlook Ben Eater's 8 bit computer built on a bunch of prototype boards. It is a VERY approachable project.Note that page 620 makes reference to the idea of 'buses'. Ben's project does things in a very similar way - he has some prototype boards down the middle of the project for the bus.There is an entire video series on this project and I binge watched them last week. It's an amazing project build with discrete logic. No, the architecture won't be challenging anything we use today but it's done with fairly discrete logic so that counts for something.This is far more approachable than the LC3 project for newcomers.I would do Ben's project and skip the LTAOE stuff altogether until they get to the 8051 and then I would consider the trainer I linked above. Or not... Ben's project has a lot of education left in it.Hint: Don't buy the cheapest prototype boards you can find. Figure to pay about $8 each, maybe a bit more. Get them from Amazon as Ben recommends. You simply do not want to chase bad connections in a project like this.

author: bd139
author_rank: Super Contributor
timestamp: May 05, 2018, 10:29:21 pm
content: Dump this part of the book's requirements entirely and buy an AVR / ARM / PIC dev board and follow the general concepts rather than the board and processor specifics. It's a bit archaic to be honest.rstofer's suggestion is a damn good one. But when you need to learn about integration and peripherals and become productive, there's nothing like a real uC to play with.

author: rstofer
author_rank: Super Contributor
timestamp: May 05, 2018, 11:19:45 pm
content: Quote from: bd139 on May 05, 2018, 10:29:21 pmI thought there would be great benefit in knowing CPUs at the dirt level. That's the way it was taught when I was in school but the micro hadn't been invented.Knowing the nitty gritty may be quite helpful but clearly Ben Eater's computer isn't going to set the world on fire with only 16 byte of RAM. But it's a start!The beauty of the project is Ben's videos. There's an enormous education in those tutorials.Then move on to one of the ARM chips (or take an intermediate step through the Arduino arena) and move into the modern era. There will be no disadvantage to knowing exactly how CPUs work but all of a sudden, the work morphs into programming.The more I watch Ben's videos, the closer I get to building the thing. Just because...A more realistic computer which could be built using the same concepts is BLUE , a 16 bit computer with 4k of RAM. This computer is described in Caxton C Foster's "Computer Architecture"https://www.alibris.com/Computer-Architecture-Caxton-C-Foster/book/1255656As described in the book, this computer is similar to one that might cost $5k back in the very early '70s.

author: bd139
author_rank: Super Contributor
timestamp: May 05, 2018, 11:24:59 pm
content: Definitely agree you should build the CPU. But when it’s done, start looking at commercial devices after.I built a 4 bit CPU many years ago our of TTL when I was at university. Somewhat simpler than Ben’s machine for certain as it was only about 12 ICs and used a one chip ALU (74181). And the instruction set was crap. Most of it was bus control.Another one worth studying is the MC14500. It’s so simple it’s possible to understand it properly.

author: David1
author_rank: Contributor
timestamp: May 06, 2018, 05:36:49 am
content: Brilliant, brilliant, brilliant, thank you rstofer I shall do some research on your suggestions.

author: David1
author_rank: Contributor
timestamp: May 06, 2018, 10:02:22 am
content: Following up your ideas rstofer has helped clarify what I'm trying to learn; there are four main threads:1. How to control stand-alone devices such as data loggers that monitor stress gauges, pressure sensors, rotation counters, proximity detectors and other sensors.2. How to link devices similar to 1 above to a PC to capture data in real time or download data captured remotely.3. How to build remote controlled buggies to carry and orientate monitoring equipment and cameras, and relay data wirelessly.4. Building other electro-mechanical devices.So I've messed around with Arduino which provides some instant gratification but I kept bumping up against my basic ignorance of electronics, hence the LAoE course. Having just read the article below, learning about the 8051 does sound helpful for what I want to do, so that route rather than the Dallas big board or other computer building tutorial seems right for me.https://www.technobyte.org/2016/10/8051-not-old-still-popular/So it sounds like a Silabs C2 USB programmer plus a USB logic analyser for less than 20 quid all in gets round the LCD module with added functionality for the 8051 route, but not the keypad.https://www.ebay.co.uk/itm/272558679897http://hobbycomponents.com/testing/243-hobby-components-usb-8ch-24mhz-8-channel-logic-analyserThere is a schematic of the LCD board on the last page of LCD Functions document on the LAoE website and it doesn't look like the keypad is part of it:https://learningtheartofelectronics.com/parts-lists/lcd-display-and-programming-board/There's also a photo of the keypad on Page 618 of LAoE. I'm assuming the USB programmer will take care of input once the 8051 is up and running but not for Chapters 14 and 15 on logic gates and flip flops. So still looking for suggestions on alternative approaches to providing the keypad functionality which includes: controlling lines D4 to D14 of an XC9572XL counter; and writing 8 bit values to RAM via a 74HC541 octal 3-state buffer.

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 02:44:02 pm
content: Quote from: David1 on May 06, 2018, 10:02:22 amUSB HID will become your new best friend. It allows a small packet to be transmitted over USB at a fairly fast rate. I used this approach to add switches, knobs and dials to Microsoft Flight Simulatorhttps://www.pjrc.com/teensy/rawhid.htmlQuoteThis is a fairly high level robotics kind of deal. There are single chip solutions to WiFi. Basically, the robot is a client that makes a TCP connection to a host (PC) and things happen from there. Network communications is easier to accomplish in Linux.https://www.espruino.com/ESP8266QuoteThe only people who think the 8051 isn't dead are the ones married to it. The architecture is ugly when you start looking at the low RAM area. OTOH, there are some jazzed up versions that are quite capable like the 80c552https://www.nxp.com/docs/en/data-sheet/80C552_83C552.pdfThere are countless possible microcontrollers but for the last few years everything is centered around ARM processors. Boards like the STM32F410RB provide a tremendous upgrade over the standard Arduino. One of my favorite prototype ready boards is the original mbed with the LPC1768 ARM processor. I like using the online toolchain at mbed.orgYou are basically getting into IoT, Internet of Things - there's a lot of work being done to connect toasters to the Internet.https://os.mbed.com/hardware/I want my boards in one of two ways: Either I want a 'stamp' configuration where the device is mounted on a header board with no onboard components or I want a board with a lot of gadgets. For me, when using FPGAs, having gadgets is a paramount consideration. For ARM processors, the stamp version is pretty easy to expand. I have built up daughter cards for the IO and just soldered in the entire stamp board.https://os.mbed.com/platforms/mbed-LPC1768/The XC9572XL is NOT a counter. It is a CPLD (Complex Programmable Logic Device) that is PROGRAMMED to implement the logic surrounding the keyboard and pushbuttons. One thing it does is implement a program counter.Here is a helpful link:https://learningtheartofelectronics.com/parts-lists/parts-lists/Here is a more helpful SUPPLIERhttp://www.proto-advantage.com/store/advanced_search_result.php?keywords=laoeApparently you can buy the CPLD on a carrier board and it comes programmed - I think!The code for a blank CPLD might be here:https://learningtheartofelectronics.com/program-listings/verilog-code-2/It will take a giant step up to get the device programmed.There are two parallel tracks in the LTAOE book: Build a microcontroller or buy a microcontroller. If I were of a mind to build a microcontroller as a method of learning about discrete logic, I would skip LTAOE and do Ben Eater's project. As a computer it isn't much but his videos are an educational program all by themselves.ETA: Watch the entire video series and see what you think. I think the project is pure genius.If you go with the 'buy' approach, that 'trainer' I linked earlier might be another option.Most of your wish list above is fairly high level stuff. Whether it is actually necessary to understand gates and flops is debatable. It is useful and would be a natural progression but there's quite a road between NOR gates and ARM processors connected via WiFi to Linux.

author: David1
author_rank: Contributor
timestamp: May 06, 2018, 04:24:31 pm
content: Wow thank you so much rstofer, this is really helpful and I will investigate it all. I recon it takes about 10 years to get really good at something and I'm just at the beginning, so happy to put in some hard work. Thanks again.

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 05:10:12 pm
content: There's more to the keypad than just the CPLD. The CPLD implements a 16 bit address counter that will count up or down and can be preset to some value from the keypad.The thing is, there's a bunch of unspecified logic around the keypad itself including the 2 digit 7 segment display and none of that is described (AFAICT). This is important because most keypads output a row/column connection when a key is pressed. There are 4 rows and 4 columns for the typical 16 button keypad and when a button is depressed one row wire is shorted to 1 column wire. There is no concept of an 8 bit binary output. That needs to be created!What usually happens is there is some kind of scanner sending outputs to the row lines and looking for signals coming back on the column lines (or vice versa). It is often done with a chip like this:https://www.jameco.com/z/74C922-Major-Brands-16-Key-Keyboard-Encoder-DIP-18_44564.htmlFor a keypad like this:https://www.jameco.com/z/AK-1604-N-BWB-Keypad-16-Keys-Matrix-Output_2131055.htmlThe encoder gets us a 4 bit binary code of the key and a DataAvailable strobe. Note the two digit display! I believe they take two consecutive keypresses and shift them into an 8 bit output. This makes sense as there are 8 databits in the 16 bit output of the CPLD. The upper two bits of the 16 bit word are the dipswitches and the low 4 bits are '0'.So what has to happen is to figure out how they took the keypresses, latched them and shifted them. AFAICT, none of this is shown.Oh, and you need some 7 segment driver chips - these are mostly out of production.https://www.eevblog.com/forum/beginners/7-segment-display-driver-for-hexadecimal/After the keyboard has finally come up with the 8 bits + 2 high bits for pushbuttons and 4 low order bits of '0', the 16 lines are sent over to the CPLD and it uses the data to load the counter under some circumstance (LoadBar or SyncLoadBar go active).All of which is to say that there is some substantial design work to implement the keyboard as it is shown on page 618. Those extra DIP packages are there for a reason. And, yes, they could all be replaced by another CPLD.So, what is the point of the Labs? This material makes sense if you're in a lab at Harvard where they have the boards made up. Following along at home appears hopeless or maybe just extremely difficult. There are plenty of processors that can do everything their boards can do and the experiments can be modified easier than it will be to duplicate their environment. An environment based on what most would consider to be obsolete. There are better ways. Even the Arduino should be able to do all of the application experiments. Or the experiment can be modified until it can!It is true that the idea of 'buses' is better described on an 8051 (or, better yet, a Z80) because they are so obsolete that they don't have internal flash and RAM. They actually NEED an external bus to connect to memory.If you just absolutely MUST do the LTAOE stuff, you build up the keypad thusly: You use an Arduino with IO Expanders. One IO expander will scan the 8 keypad inputs. There will be 4 outputs and 4 inputs on this expander. You use two expanders for the 16 bit output. You run the two dip switches to Arduino inputs. You can use 2 more IO expanders to drive the LEDs.You need 5 IO lines for CS' for the five IO expanders that are connected to an SPI bus on the Arduino. Now all you have to do is write code to scan for a key press, decode the press to hex and shift it into an 8 bit binary variable. You take this (and its higher order mate) and decode them to 8 bits for driving the 7 segment displays. Send the result out over SPI. While you're at it, make up the 16 bit value and send it out to the other pair of expanders.http://www.microchip.com/ParamChartSearch/chart.aspxYou can use 16 bit expanders for both the counter output and the LED drivers. This reduces, by 2, the number of IO lines needed for CS'Definitely doable! Elegant even! It sounds more complicated than it is. You have a 16 bit expander for the keypad output, a 16 bit expander to drive the LEDs and an 8 bit expander to read the keypad. And an Arduino for the orchestra conductor. Definitely doable! And it could be built on a prototype board. In fact, the ATmega328 could be programmed as a separate device so no Arduino board is used at all. Just chips on a breadboard. How cool is that?I would think about my goals. Do I want to know at the chip level how a CPU works? This is a worthy goal and the education will be worth the time and money. I would take on Ben Eater's project in a heartbeat! It is documented and it works. It isn't going to set the world on fire but there is a lot of value in the project if low level logic design is a learning goal.If I didn't give a rat's patuti about chips and logic and I just wanted to stay at the microcontroller level and above, I certainly wouldn't take a trip down memory lane with an 8051 just so I could see some bus signals. I would grab up an Arduino or, better, one of the STM32F ARM boards and get on with higher level projects. Nobody is designing with DIP packages any more. If we do want to experiment with CPU designs, all the logic is created by typing and synthesizing to an FPGA.More ironic: If you don't have a scope, you can't see the bus signals anyway. A logic probe is another artifact of a long ago world. Yes, I have several and I can't recall using one in the last 20 years. Logic is moving too fast for a probe to be able to do anything more than say that something happened about a million clocks back.Unless you can single step the logic and, to their credit, LTAOE does make an arrangement for that. It's yet another CPLD. Ben's CPU does single step as well.Enough... Good luck!

author: bd139
author_rank: Super Contributor
timestamp: May 06, 2018, 05:48:50 pm
content: There’s always “art of electronics laboratory manual”. 1st edition of it, which is the one I did, uses Z80 and you have to assemble the code with a pencil and paper and switch it in

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 05:56:22 pm
content: Which is pretty much how my Altair 8800 was bootstrapped in the old days - before EPROM boards came along.Lots of DEC machines were bootstrapped the same way. Toggle switches RULE!ETA: Real programmers don't need no stinking assembler!

author: Old Printer
author_rank: Frequent Contributor
timestamp: May 06, 2018, 07:21:52 pm
content: I have spent a lot of time in Ben Eaters videos, and there is far more to be learned from them than just computer logic. He is an absolute great instructor. He devoted a video to the nuts & bolts of the project with a section on getting the right grade breadboards. If I can locate the video I will link it, but he describes the details of the boards and what to look for. I have not built his whole project, but have assembled many of the sub-circuits just to learn. I get my breadboards and many other components from MP Jones in Florida. A close exam of the boards matches the points Ben feels are important and I think they are made by the same company. MP Jones regularly sells them for $4.95 but occasionally blows them out for about $2 at which time I stock up. Here is a link.http://www.mpja.com/830-Tie-Point-Solderless-Breadboard-Unmounted/productinfo/24443+TE/Another youtuber on similar subjects is Derek Molloy, a college professor and great teacher who also delves into the Analog Discovery and Beaglebone.

author: David1
author_rank: Contributor
timestamp: May 06, 2018, 07:35:37 pm
content: Haha damn and I just ordered a logic probe!

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 08:26:22 pm
content: For a project where the clock can be slowed down, like Ben Eater's project, a logic probe will work well. In fact, his demos almost always show the LEDs blinking at a human rate. There are a lot of gating signals that will be fun to probe.It's when you get to full-blown microcontrollers running at a large number of megahertz that logic probes become door stops.I found a complete parts list for Ben's project with links to various suppliers including Amazon for which, if you click through his link, he gets a finder's fee.The prototype boards he suggests run a little under $8 at Amazon. Clearly NOT the low price spread. OTOH, if there is a significant difference among prototype boards, I am inclined to go with the recommendation rather than have to troubleshoot poor connections.There's a thread around here somewhere on the manufacturer who actually builds the 3M boards, considered by many to be the best of breed. Maybe a 'Search' will turn it up.Apparently the project takes 14 boards so call it 15 and you're looking at somewhere around $120, just for boards. But the boards last forever. Once this project is complete, they can be reused.https://www.amazon.com/gp/product/B0040Z4QN8/ref=as_li_ss_tlFor me, I would put the project in an acrylic box and hang it on the wall as art. There's nothing quite as satisfying as blinking LEDs.I'm a huge customer of Amazon so I would probably get most of the stuff there after I checked the price with DigiKey, my favorite electronics supplier.https://eater.net/

author: bd139
author_rank: Super Contributor
timestamp: May 06, 2018, 08:47:43 pm
content: CPC and Farnell here in the U.K. were selling off Wisher boards for a very low price recently. They are pretty good. As good as 3M ones.

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 09:01:22 pm
content: There are also some solder type breadboards with exactly the same configuration as these prototype boards. Once the project is known to be correct, move the components to the solderable boards and mount it under glass.

author: bd139
author_rank: Super Contributor
timestamp: May 06, 2018, 09:04:17 pm
content: You’re giving me ideas now too

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 10:16:37 pm
content: Quote from: bd139 on May 06, 2018, 09:04:17 pmIdeas? I just ordered the parts!I have no idea why I am going to build this thing but I think the idea of wall art sent me around the bend. Come on, how cool is that? Talk about geekdom...The 28C16s had to come from eBay as did the 74ls76s. This is regrettable. If I have a problem, I'll just design my way out of it. I will also need to buy a couple of SOIC 24 -> 24 DIP adapters. But I don't need them today...7476s are available and should probably work fine but I decided to stay close to the list. No really good reason...I got the other ICs at Jameco but I ordered a bunch of stuff through Amazon (prototype boards, LED, switches, 7-segment displays, wire, etc). I clicked through Ben's shopping list so he should make a little off the deal.I don't really have a project on my table at the moment and this is as good as any.

author: bd139
author_rank: Super Contributor
timestamp: May 06, 2018, 10:31:30 pm
content: Sounds good. I have a metric crap ton of LEDs and TTL ICs in stock so might be an excuse to use 'em all up too. I have three unfinished projects sitting around so I am going to resist for now

author: rstofer
author_rank: Super Contributor
timestamp: May 06, 2018, 11:23:47 pm
content: These days there is very little work being done with SSI or MSI (small/medium scale integration) so any chips I have can be devoted to this project and never missed. It will be good to use them up!It's going to be fun!

author: David1
author_rank: Contributor
timestamp: May 07, 2018, 07:24:23 am
content: Got it!There's a schematic of the keypad in the old Student Manual (thank you bd139!) at the end of Chapter 15. Not sure what the dotted line on the right linking the square boxes means, nor the disembodied U4c bottom-centre, but it can't be that hard (famous last words!)

author: bd139
author_rank: Super Contributor
timestamp: May 07, 2018, 07:55:37 am
content: Just a note the old student manual keypad is different to the new one.

author: rstofer
author_rank: Super Contributor
timestamp: May 07, 2018, 01:41:28 pm
content: Any way to post a decent image?I am thinking that building the keypad with an Arduino Nano and port expanders is the way to go unless a complete schematic can be found.Using a 3.3V Arduino with 3.3V IO expanders will work fine on the outputs to the counter. The logic levels on output pins will be high enough to work.All of the inputs (IIRC) are switch contacts so they won't be driving voltage to the Arduino. If there is a 5v logic input signal required, it will need to run through a voltage divider before hitting the Arduino. Not a big deal, just a couple of resistors.https://learn.sparkfun.com/tutorials/logic-levelsThere is also a lot of interest in using the 74HC595 shift register. This device can run on 3.3V (article below talks about 5V) so everything should work fine. The Arduino library has a ShiftOut function for driving the chip. Basically, you cascade as many devices as necessary (5?) and on every iteration, you shift all the bits (40?) bits. This needs to be done at a rate that works well for the keypad scan.I prefer the SPI port expanders because I can address individual chips. I can use just one 8 bit expander to scan the keypad, a 16 bit expander to drive the 7 segment displays and another 16 bit expander to send the address value to the counter. Simple and I don't have to drive the display or switch expanders until something changes on the keypad expander.3.3V expanders are available in both 8 and 16 bits.https://www.arduino.cc/en/Tutorial/ShiftOuthttps://www.arduino.cc/en/Tutorial/ShiftInhttps://www.arduino.cc/en/Reference/SPI

author: David1
author_rank: Contributor
timestamp: May 07, 2018, 03:53:54 pm
content: @bd139. Do you know what's different about the old and new keypads?

author: David1
author_rank: Contributor
timestamp: May 07, 2018, 03:59:44 pm
content: @rstofer If you Google "student manual for the art of electronics" someone has pirated the whole thing...

author: bd139
author_rank: Super Contributor
timestamp: May 07, 2018, 04:03:13 pm
content: Look on libgen.ioThe 2nd edition keypad (sorry wasn't 1st) is used to load SRAM up for a 68k CPU so had some stuff in it to support that.

author: rstofer
author_rank: Super Contributor
timestamp: May 07, 2018, 06:36:38 pm
content: I'm pretty sure the keypads are identical. Signals not used in the latest edition simply won't be used. I suppose the logic could be eliminated for unused signals but that might be unwise.I have never heard of the MC14490 Hex Debounce Circuit - surprisingly, they are in stock at DigiKey. Very handy chip!

author: David1
author_rank: Contributor
timestamp: June 20, 2018, 07:02:52 pm
content: Update on 20 June 2018:The author, Thomas Hayes, has been away on vacation but has got in touch to say he will put up-to-date details of the keypad on the Learning the Art of Electronics website. It is different from the one in the old Student Manual as he has re-designed it with a microcontroller in place of the many IC's of the older version, to do keypad scanning, switch de-bouncing and display.