Silicon ChipMax’s Cool Beans - January 2022 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions: PicoLog Cloud
  5. Back Issues: PICOLOG
  6. Publisher's Letter
  7. Feature: The Fox Report by Barry Fox
  8. Feature: Communing with nature by Mark Nelson
  9. Feature: Net Work by Alan Winstanley
  10. Project: Vintage Battery Radio Li-ion Power Supply by Ken Kranz and Nicholas Vinen
  11. Project: The MiniHEART by John Clark
  12. Project: Balanced Input and Attenuator for the USB by Phil Prosser
  13. Feature: Flowcode G raph ical Programming by Martin Whitlock
  14. Feature: Max’s Cool Beans by Max the Magnifi cent
  15. Feature: PICn’Mix by Mike Hibbett
  16. Feature: Circuit Surgery by Ian Bell
  17. Feature: AUDIO OUT by Jake Rothman
  18. Feature: Make it with Micromite by Phil Boyce
  19. PCB Order Form
  20. Advertising Index

This is only a preview of the January 2022 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Max’s Cool Beans By Max the Magnificent Flashing LEDs and drooling engineers – Part 23 H oly socks, Batman! I simply cannot believe it’s Crimble season again. I don’t know whether I’m coming or going, I don’t have a speech prepared, and I don’t have a thing to wear. One problem is that there are so many fun things to do, but so little time to do them all. A related problem is that I’m doing so many fun things that my poor old noggin is jam-packed with ‘stuff’; for example... Toroidal transformations For reasons that will be made clear in the fullness of time, I’ve been cogitating and ruminating on the maths associated with the topic of twisting a torus (plural tori), a.k.a. a donut (and it’s not often you expect to hear yourself say that). Actually, full-blown tori are still sometime in our future. Before we get there, let’s start by imagining that we cut a strip of paper. Let’s call the corners at one end of the strip A and C, while the corresponding corners at the other end are called A’ and C’. Now visualise bending our strip around to form a circle (Fig.1a). If we join the two ends ‘as-is’ without twisting the strip so that A’ is connected to A and C’ is connected to C, we end up with a ring that has two edges (top and bottom) and two sides (outside and inside). Now visualise what happens if we give one end of the strip a half twist before joining the two ends, such that A’ is connected to C, and C’ is connected to A. In this case we have created a Möbius strip (a.k.a. Möbius band a.k.a. Möbius loop) that has only one edge and one side (A -> A’ -> C -> C’ and back to A again). I’m sure you’ve seen this before, but on the off chance you aren’t convinced, why not try making one yourself just for giggles and grins. Finally, if we give the end a full twist before connecting the two ends, we return to having two sides and two edges. And so it goes – twists of 0, 1, 2, 3... result in two sides and two edges, while twists of 0, ½, 1½, 2½, 3½… result in one side and one edge. So far so good. Now, suppose we create what we might call a ‘cross-strip’ (Fig.1b). In this case, we might call the corners at one end A, B, C, and D, while the corresponding corners at the other end are 44 called A’, B’, C’, and D’. Once again, let’s start by visualising bending our strip around to form a circle and joining the two ends ‘as-is’ without twisting the strip such that A’ is connected to A, B’ is connected to B, C’ is connected to C, and D’ is connected to D. In this case, we end up with four edges (A -> A’, B -> B’, C -> C’, and D -> D’) and four sides (both sides of the plane delimited by A, C, C’, A and both sides of the plane bounded by B, D, D’, B). Now for the questions... we’ll start with the low-hanging fruit in the form of Q1: How many edges and sides will we have if we give one end of our cross-strip a full twist before connecting the two ends (so A’ is connected to A, B’ is connected to B, C’ is connected to C, and D’ is connected to D)? Q2: Only slightly harder, how many edges and sides will we have if we give one end a half twist before connecting the two ends (so A’ is connected to C, B’ is connected to D, C’ is connected to A, and D’ is connected to B)? Q3: This one makes my head hurt; how many edges and sides will we have if we give one end a quarter twist before connecting the two ends (so A’ is connected to B, B’ is connected to C, C’ is connected to D, and D’ is connected to A)? (The answers can be found at the end of this column.) Electronics that work Gas-heated soldering iron Have you ever heard of a gas-heated soldering iron? Note that I didn’t say ‘gas-powered,’ which might conjure up images of a splendid steampunk contraption. What I’m talking about is my very first soldering iron, which was literally a small cylinder of iron that was shaped into a point at the business end. The other end was connected via an iron rod to a wooden handle, which (in my case) was held by someone who didn’t have a clue what he was doing. This was circa 1969 and I was 12-years old at the time. I have no idea where this iron came from or who gave it to me. I think it was originally intended for working with metal, not electronics, but it was all I had, and I was happy to have it. I would heat my iron over the largest gas ring on our cooking stove in the kitchen until it glowed red-hot. Then I would race up the stairs to my bedroom to solder as many joints as I could before it cooled down too much to continue. This provided great exercise both physically (running up and down the stairs) and mentally (trying to work out why my circuit wasn’t working due to dry/cold solder joints). When I eventually managed to save enough of my pocket money to purchase an electric iron, I opted for a cheap-andcheerful standalone device that came equipped with a small metal stand to hold the hot end away from the work surface (the bedroom floor in my case). Apart from a single foray into a fullblown soldering station, which ended when I dropped it, thereby transmogrifying it into a paperweight, I’ve stuck with standalone soldering irons until just a couple of days ago. What happened was that the nice folks at Tilswall ran across my Apropos of nothing at all, earlier today as I pen these words, my chum Steve Leibson posted a review of a rather interesting book called Designing Electronics that Work by Hunter Scott – see: https://bit.ly/3qk3qBq I hold Steve in high regard, so if he says a book is worth reading, I believe him. In fact, Steve goes so far as to say: ‘Whether you’re a maker, hobbyist, novice design engineer, or one of Twist= ? Twist= ? those seasoned grey A A’ A A’ hairs who know how B B’ to hold their tongue at D D’ exactly the right angle when making adjustC C’ C C’ ments, the PDF version (a) Single strip (b) Cross-strip of this books is free, so you should download Fig.1. A simple strip of paper is more complicated than it looks! a copy today.’ Practical Electronics | January | 2022 on a single Arduino Nano. If you search on Github for the FastLED library, there is an example called ‘Noise,’ which explains a lot better than I can how it works. I copied the code and removed the bits I didn’t need. There are a few variables you can set for speed and level of depth – I just used a simple pot on an analogue input to alter the scale in real time.’ On occasion, I may have mentioned my 12×12 array of ping-pong balls, where each ball is equipped with a tricolour LED. In fact, I vaguely recall dropping it into the conversation in some of my Cool Beans columns (PE, June 2020 to January 2021 and April 2021 to July 2021). The point is, as soon as I get a free moment, I’m going to download the example code Paul talks about and tweak it to run on my ping-pong ball display. I shall, of course, report back in a future column. Fig.2. Work starts on my new robot head with my new Tilswall soldering station (upper right). Cool Beans Blog (https://bit.ly/2ZY4waZ) and emailed me to ask if I’d like them to send me one of their soldering iron stations (https://bit.ly/3BuhbiW) to use on my hobby projects. They caught me at just the right time, because – as I discussed in my previous column (PE, December 2021) – I was poised to commence work on a new robot head with servos and a corresponding control system. A few days later, my new Tilswall soldering station arrived and I set to work (Fig.2). I’ve only been using this little beauty for a couple of days, but I have to say that I’m very impressed. This antistatic, ESDsafe station is a substantial unit that I believe offers amazing value for the price. It also comes with a collection of five different bits and a small spool of lead-free solder although – if the truth be told – I’m afraid I’ll continue to use my trusty 63:37 Fig.3. The Fool’s Lantern (Image source: Bad Dog Designs) Practical Electronics | January | 2022 silver-lead solder (‘you can’t teach an old Max new tricks,’ as they say). Flashback to the 1970s I’d like to say that I remember the 1970s as though they were yesterday, but a lot of Pooh Sticks have passed under the bridge since then. What I do remember is the abundance of groovy text fonts and the proliferation of psychedelic colour schemes. At that time, one of the big lighting effects that made its presence felt at the discos I attended as a student was from oil wheels. In fact, I just found a video on the Funky Parrot website (https://bit. ly/3qidtHe) showing a Selection of 1970s Disco Lighting 6” Oil Wheels that took me back in time (https://bit.ly/3qkNgYr). The thing is – several times over the past few years – I’ve seen swirling effects presented on tricolour light-emitting diodes (LED) matrices that remind me of those old oil wheel displays. And each time I’ve seen something like this I’ve thought, ‘I’d like to do something like that,’ but I haven’t known where to start. Then, just when I was least expecting it, my chum Paul Parry who owns Bad Dog Designs (https://bit.ly/3BWMjb9) sent me an email with a link to a YouTube video of one of his latest creations that he’s named the Fool’s Lantern (https://bit. ly/3H6GMCv). This link was accompanied by a message saying, ‘I made this earlier on this week and thought you might like it because it ticks lots of boxes.’ Basically, this is one of Paul’s famous Nixie tube clocks presented in an antique wooden cabinet and augmented by a 16×16 matrix of WS2812B tricolour LEDs (Fig.3). The video shows lots of different lighting effects, but one that caught my eye was the swirling oil wheel-type effect that starts around 1:00 into the video. When I asked Paul about this, he replied: ‘The code is pretty simple and it runs quite happily Teachable moments If you are an old hand at constructing electronic doodads, you may want to jump forward to the next topic. However, I do receive a lot of emails from readers of this column who are just starting out in electronics and – while I was commencing work on my new robot head – I jotted down a few notes that might be of interest to beginners. Let’s start with the concept of static electricity. When we walk around or rub against something, electrons can be transferred from one object to another, leaving one of the parties with an excess positive charge and the other with an excess negative charge. We call this, ‘static electricity’. If we accumulate such a charge and then come close to a conductor with a path to ground, the result will be an electrostatic discharge (ESD) event, which may include a spark that makes life exciting for a while. If the conducting path happens to pass through the pin of a semiconducting device like a diode, LED, transistor, or integrated circuit (IC) (a.k.a. a silicon chip), then – much like Monty Python’s Dead Parrot sketch – we may well find ourselves looking at an ex-semiconducting device with little tears running down our cheeks. The solution is to ensure that everything – our components, our tools (eg, soldering iron), and ourselves – is at the same electric potential before we touch anything. As a reminder, you may recall that I described the Tilswall soldering station we discussed earlier as being antistatic and ESD-safe. Now you know why this is an important attribute to have in your soldering station. Take another look at Fig.2, which features a folding table I set up in the corner of our family room to work on. My wife (Gina the Gorgeous) is more than happy to let me do this, just so long as everything is cleared away by the end of the day (I 45 The solution is that my chum Rick Curl used to work for a company where they stripped this braid off large power cables and – unbelievably – threw it away because all they were interested in was the insulated core cables. As a result, several years ago, Rick gifted me with a lifetime supply (Fig.4). Once you’ve wired your board, Fig.4. Yours truly with his stash of copper braid that will protect a before you insert plethora of projects from ESD. any ICs and connect the power supply, use your multimeter to check so want to have my own workshop). that everything is as it should be; ie, There are several things to observe in this that all of the things that are supposed image, starting with the antistatic mat to be connected to the ground terminal covering the table. This mat is groundare indeed connected to the ground tered through the yellow banana plug to minal, that all of the things that are supthe power strip. Similarly, the antistatposed to be connected to the power teric wristband (middle left-hand-side) is minal are indeed connected to the power grounded through the blue banana plug terminal, and – most importantly – that to the power strip. the power and ground terminals aren’t Now observe the small proto-board connected to each other. with the 18-pin IC socket and the three Next, still without populating your toggle switches sitting next to the blue ICs, apply power to the board while wire strippers. Using IC sockets is recombeing poised to immediately disconnect mended for two reasons. First, it lets us it if you hear any weird sounds, see any easily swap out our silicon chips if they strange smoke, or smell any unexpected are damaged for any reason, like static odors (all phenomena with which I have electricity, for example. Second, they had much acquaintance over the years). let us easily confirm that the power and This is a perfect time to recheck your ground wires go to the right pins withIC data sheets to ensure that the power out forcing us to discover they don’t by and ground pins are where you expect blowing up our chips. them to be, and to use your multimeter The point is that, even when we are to ensure that these pins are connected working on a board that is not yet poputo the power supply as they should be. lated with ICs or other semiconducting Only now should you power the board components, it’s good practice to always down, insert the ICs, power it up again, work on an antistatic mat and wear an and perform another check to confirm antistatic wristband. If you always do that everything is tickety-boo. this so that it becomes ‘second nature,’ it will save you a lot of grief down the road. Trust me on this because I know whereof Feel the joy! I speak. There’s an old saying that goes Returning once more to Fig.2, observe something like, ‘Experience stops you the grey wooden platform in the center making mistakes, but it’s making mistakes of the picture. The two black protuberthat gives you experience.’ The real trick ances are JH-D400X-R4 10K 4-axis joyis to learn from someone else’s mistakes. sticks, which you can find all over the As an aside, given a choice, when I’m place, including Amazon and eBay (Fig.5). building one of my larger hobby projUnfortunately, they typically don’t ects, like my Prognostication Engine come with documentation, which can (PE, March 2020), for example, I like to make life interesting for beginners. Before protect my cables by wrapping them in you discard the box that the pot came in, copper braid whose ends are connected look for a small packet containing four to ground (you thread a bunch of wires tiny fixing screws that will be a pain in through the hole running down the center the nether regions to replace if you acof the braid, and then pull the ends of the cidentally throw them away (once again, braid, which causes it to shrink in diamI speak from experience). eter and hug the wires). The problem is The hard plastic ring with the four holes that this braid is ferociously expensive. can be lifted away. Less obvious is the 46 fact that the soft inner plastic cover with the ripples can be slid up the joystick towards the knob (it may be a tight fit, but it will slide). This exposes four tiny holes in the corners of the case, which we will use to attach the joystick to our console (the grey wooden platform in my case). What we do is drill a 1.5-inch-diameter hole in the console surrounded by four small holes for the screws (use the hard plastic ring as a template). Push the knob up through the hole from the bottom while squeezing the soft inner plastic cover so that it also comes through the hole to be on top of the console. Keep on raising the joystick so it presses against the bottom of the console, slide the soft plastic cover down until it rests on the top of the console, return the hard plastic ring over the top of the knob, and use the four tiny screws to secure the beast. Now, although these purport to be 4-axis joysticks, we should note that they are really only 3-axis devices that consist of three 10kΩ linear potentiometers (pots) and a normally open (NO) pushbutton switch on the top (the creators of these devices are using literary license to persuade us that the pushbutton represents a fourth axis of control). Let’s remind ourselves that a pot has three terminals, two of which are connected to either end of a resistive element (10kΩ in our case), while the third is connected to a movable wiper (Fig.6a). A pot can be used as a rheostat (variable resistor) or as a voltage divider. We will be using our pots as voltage dividers. This means that we will be connecting power to terminal (1) and ground (0V) to terminal (2), or vice versa – it doesn’t really matter which way round these go because we can swap the final readings over in software. With respect to this design, power will either be 3.3V or 5.0V depending on what sort of MCU we are using. If you are using a MCU like an Arduino Uno, which is powered by 5V and whose input pins support 0 to 5V, then you will use a 5V supply for your pots. In my case, I’m using a Teensy 3.6, Fig.5. JH-D400X-R4 10K ‘4-axis’ joystick. Practical Electronics | January | 2022 2 (b) Pot 3 3 2 2 2 Pot 0 Pot 1 Pot 2 Pot 3 Pot 4 Pot 5 In Fig.6b, I show the wiper terminal as being the one in the middle. This is the way things will be with more than 99% of the pots with which you come into contact, but it is possible to run across other configurations. Here’s the way I did things. For each pot, using my trusty multimeter, I measured between terminals 1 and 2 to ensure that the resistance value was indeed 10kΩ, give or take (GoT). Remembering that, in the case of this type of joystick, the stick automatically returns to its center position, for each pot I checked that the resistance between terminals 1 and 3 was 5kΩ GoT; similarly, between terminals 2 and 3. Finally, I checked that the resistance between terminals 1 and 3 varied between 0kΩ and 10kΩ, or vice versa, when the pot was pushed or rotated to its limits; similarly, between terminals 2 and 3. You may feel that all this is overkill but – once again – let me reiterate that it’s a lot easier to observe and identify problems when the pots are standalone than it is when you’ve connected them all together. And, speaking of connecting them all together, what we are going to do now is to connect one side (which we call terminal 1) of all of our pots together. In the fullness of time, we will connect this side to our power supply. Similarly, we are going to connect the other side (which we call terminal 2) of all of our pots together. In the fullness of time, we will connect this side to our ground (0V). The result is that our six pots are wired in parallel (Fig.7). Remember that I’m using a Teensy 3.6, so I’ve shown the power as being 3.3V, but it may be 5V in your case. At this stage, however, this is irrelevant because we haven’t actually connected our pots to our power supply yet. Also, we haven’t yet connected their wipers to our MCU’s analogue input pins. So, if you were to set your multimeter to measure resistance and connect one probe to the wire connected to all of the Practical Electronics | January | 2022 3 2 which is also powered by 5V but whose inputs will only tolerate 0 to 3.3V, so I’m using a 3.3V supply for my pots (this supply is generated by a regulator on the Teensy 3.6). Returning to Fig.5, the two pots we can see on two of the sides respond to forward/backward and left/right motions of the joystick. The third pot, which is hidden inside, responds to our twisting the stick clockwise or anticlockwise. When we take our hand off the stick, it returns to its center position with respect to all three pots. It’s up to us to add wires to the forward/backward and left/right pots. When it comes to the third (internal) pot, observe the five wires coming out of the base. Two of these wires will be the same colour; these are the ones that are attached to the pushbutton switch. In my case, these two wires are yellow, but they are blue on the equivalent pots purchased by my co-conspirator Steve Manley in the UK. All we have to do is connect one of these wires to ground and the other to the input of our microcontroller (MCU). Actually, in my case, I’ll be using a special switch debounce IC, but I’ll be talking about this more in a future column. If you do connect the switch wire directly to the input of your MCU, then add an external 10kΩ pull-up resistor or declare this input as being of type INPUT_PULLUP in your code (assuming you are using the Arduino integrated development environment (IDE)). The remaining three wires are connected to the internal pot. Once again, their colours may vary depending on the origin of the pots. In my case, these wires were white, black and red. My knee-jerk reaction was to assume that the white wire was the signal wire that was connected to the wiper, but it turned out that it was the black wire, so I’m glad I checked. And, speaking of checking... Let’s remind ourselves that we currently have six pots that are each supposed to be 10kΩ. If you adopt a mantra of ‘trust nothing; verify everything,’ then the radiance of my smile will lighten your life. The main point to note here is that it’s a lot easier to test your pots in isolation than it is when you’ve connected them all together. 3 2 Fig.7. Six 10kΩ pots wired in parallel. 3. 3 V 1 2 Fig.6. (a) Pot symbol; (b) backside view. Test, test, and test again 1 10 k 3 1 10 k 1 10 k 1 3 10 k 3 (a) Sy mbol 1 2 10 k 3 1 10 k 1 Not y et connected 0V terminal 2s and the other probe to any of the wipers (this is something anyone might do), what resistance would you expect to see? Would you be surprised if I told you that you should be seeing something in the region of 2.92kΩ. Also, that if you drive the pot whose wiper you are measuring to its full extreme one way, you will see a reading of 0kΩ, while driving it to its full extent the other way will result in a reading of 1.67kΩ. If you say, ‘Well, duh!’ then you need read no further. Alternatively, if you are scratching your head and your face is scrunched up into a frown (which is not a becoming look on you, I’m afraid to say), then I would be happy to expound, explicate, and elucidate further. Unfortunately, our illustrious editor says we don’t have the time or space to do this here, so I’ve written it up as a Cool Beans Blog (https://bit.ly/3omhAzC). Next time In my next column I hope to be able to show you the code that makes oil wheel-type swirly effects on my ping pong ball display. Also, we will be experimenting with more effects on our SMAD boards. And, of course, we will continue to work on adding motion to my robot head, with the ultimate goal of having it be able to turn to track me as I move around the room or to respond to any unexpected sounds. Until then, as always, I welcome your comments, questions, and suggestions. Toroidal transformations answers A1: There are still four sides and four edges, where the paths of the edges can be denoted as A -> A’, B -> B’. C -> C’, and D -> D’. A2: There are two sides and two edges, where the paths of the edges can be denoted as A -> A’ -> C -> C’ and B -> B’ -> D -> D’. A3: There is only one side and one edge, where the path of the edge can be denoted as A -> A’ -> B -> B’ -> C -> C’ -> D -> D’. Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor of all he surveys at CliveMaxfield.com – the go-to site for the latest and greatest in technological geekdom. Comments or questions? Email Max at: max<at>CliveMaxfield.com 47