Silicon ChipMax’s Cool Beans - August 2022 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions
  5. Publisher's Letter: The power of batteries
  6. Feature: Time for a total rethink? by Mark Nelson
  7. Feature: Net Work by Alan Winstanley
  8. Project: Multi-purpose Battery Manager by Tim Blythman
  9. Project: Simple MIDI Music Keyboard by Tim Blythman
  10. Project: NANO PONG ON YOUR TV by TIM BLYTHMAN
  11. Project: USB Power Delivery Chargers by Jim Rowe
  12. Feature: Make it with Micromite by Phil Boyce
  13. Feature: KickStart by Mike Tooley
  14. Feature: Max’s Cool Beans by Max the Magnifi cent
  15. Feature: Flowcode Graphical Programming by Martin Whitlock
  16. Feature: Circuit Surgery by Ian Bell
  17. PCB Order Form
  18. Advertising Index

This is only a preview of the August 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 30 I am a huge fan of Douglas Adams (RIP). In addition to The Hitch Hiker’s Guide to the Galaxy, I really like his tall tales about Dirk Gently, who bills himself as a ‘holistic detective’ who makes use of ‘the fundamental interconnectedness of all things.’ The reason I mention this here is that I’m currently experiencing a lot of fundamental interconnectedness myself, which is unfortunate because I don’t have a speech prepared and I have nothing suitable to wear. A future replete with robots As you will doubtless (well, hopefully) be aware from previous Cool Beans columns, over the past few months, your humble narrator and his friend Steve Manley have been working on an animatronic robot head. In reality, Steve has done the bulk of the grunt work while I’ve focused my attention on offering silly suggestions (I like to play to my strengths). As a result of all this activity, I’ve been spending a lot of time thinking about things like robots and motors and sensors. My wife (Gina the Gorgeous) often asks me how long it will be before we will be able to buy a robot to help her with her household chores. I fear she’s been watching too many science fiction films with me because she’s thinking of a humanoid-shaped incarnation that will be able to perform activities like crouching down and picking things up and putting them away, loading and emptying the dishwasher, similarly with the washing machine and dryer (including ironing and folding the clothes), watering the flowers in the pots and baskets on our front and back porches, accompanying her to the grocery store where she can say things like ‘get me two large cans of diced tomatoes and meet me at the meat counter,’ and so on and so forth. Not wishing to raise her hopes with unrealistic expectations, I’ve been telling Gina that it is going to be quite some time before this sort of thing comes to pass. In my heart of hearts, I’ve feared that we may not be around to see it. At the same time, having recently watched the postapocalyptic science fiction thriller film Mother Android (https://bit.ly/3N3r8tz), I’ve also been afraid that we might live long enough to regret wanting to live long enough to see it (you really don’t want to peer into what I laughingly call my mind). For example, although they are incredibly clever, the humanoid robots from Boston Dynamics that can do things like dance (https://bit.ly/3y2cezp) and perform gymnastics (https://bit.ly/3OpPkXY) are more along the lines of uber-expensive proof-of-concept creations affordable only to mega-corporations and nation states. Having said this, I’ve seen some things over the past couple of weeks that lead me to believe a future replete with robots may be closer than we think. Robots, motors and sensors, Oh my! When you come to think about it, we see and hear (no pun intended) a lot of news about the latest and greatest in visual Fig.1. Robot hand equipped with BeBop RoboSkin picking up a ball (Image: Bebop Sensors). 54 and audio sensors giving machines the ability to see and hear, including things like object detection and recognition and the ability to recognise sounds like glass breaking and to understand and respond to natural human speech. There are also developments in gustatory and olfactory sensors that will afford machines the ability to detect and identify tastes and smells. Less discussed, however, are tactile sensors that will give machines a sense of touch, but this too may be poised to change. For example, I just read an interesting article on Science Alert about how scientists have developed a ‘living skin’ for robots (https://bit.ly/3tJyXxs). Looking really icky (if you’ll forgive my talking technical), this ‘material’ is water repellent, self-healing, and has a texture just like human skin, which is perhaps not too surprising because it’s actually made out of human skin cells. By some strange quirk of interconnectedness fate, I was recently chatting with Keith McMillen, who is the founder and chief technical officer (CTO) of a company called Bebop Sensors (https://bit. ly/3N3m4p3). Of particular interest to us here, Keith has developed a smart sensing fabric that is used to create a skinlike covering called Bebop RoboSkin, which can provide humanoid robots with tactile awareness (Fig.1). The amazing thing is that this tactile awareness is claimed to exceed the capabilities of human beings with respect to spatial resolution and sensitivity. In the example shown, there are 80 taxel Fig.2. Robot finger equipped with BeBop RoboSkin reading Braille (Image: Bebop Sensors). Practical Electronics | August | 2022 Fig.3. Meet EVE, the humanoid research robot (Image: Halodi Robotics) sensors (think ‘tactile pixels’) in each fingertip, presented in an array with a 2mm x 3mm pitch. According to Keith, humans have about a 4mm pitch with respect to the nerves in our fingertips. I must admit that I was somewhat doubtful when I first heard this. My human-centric knee-jerk reaction is to think that I am the end-result of billions of years of evolution that’s left my biological sensors ‘state-of-the-art,’ as it were. However, Keith says that there’s a simple way to verify his claims. If you take two plastic knitting needles with slightly curved tips, hold them side by side, close your eyes, and touch the ends of the knitting needles to the tip of one of your fingers, it’s only when the distance between the points of the needles is 4mm or more that you can distinguish them as being separate. Have you ever tried to see (again, no pun intended) if you could read Braille? The first version of this tactile writing system, which is used by people who are visually impaired, was developed in 1824 by a 15-year-old called Louis Braille in France who lost his sight as a result of a childhood accident. Braille characters are formed using a combination of six raised dots arranged in a 3 × 2 matrix, which is called the ‘braille cell.’ This matrix offers 64 different combinations, which can be used to represent alphanumeric characters and punctuation marks (a cell with no dots is equivalent to a space). Practical Electronics | August | 2022 I once had the opportunity to run one of my favorite fi ngers over a book in Braille, and I simply could not distinguish the number and locations of the raised dots under my dexterous digit. I understand that I could learn to do so with practice, but I remember being surprised by how little I could sense. This all came back to me when Keith showed me a picture of a robot finger equipped with BeBop RoboSkin reading Braille (Fig.2). Robots, robots everywhere... I have friends at a company called Immervision (https://bit.ly/3QxxOTy). They are working on the cutting edge of machine vision, developing cameras that combine ultra-wide-angle lenses with high-resolution sensors and sophisticated de-warping, image-stitching, and machine vision software based on artificial intelligence (AI), machine learning (ML) and deep learning (DL). My friends were telling me that one of their current projects is with another company called Halodi Robotics (https://bit.ly/39vFEg5). You can probably guess what Holodi is working on. Literally yesterday as I pen these words, I was chatting with Dr. Nicholas Nadeau, who is Halodi’s CTO. The folks at Holodi have created an awesome autonomous android called Eve, which (or should I say ‘who’?) is capable of performing some of the most dexterous of human tasks. Operating with human strength and speed, Eve is capable of crouching down, reaching up, and using ‘her’ hands to open doors, push buttons, and manipulate objects (Fig.3). One of the reasons the guys and gals at Holodi are working with the chaps and chapesses at Immervision is that, in the event that Eve runs into a situation she can’t handle, she can use the internet to call out to her human companions, who can use virtual reality goggles and haptic solutions to establish a telepresence connection – seeing through Eve’s eyes and controlling her hands and body, and Immervision’s ultra-wide-angle camera subsystems are ideal for this sort of application. It’s easy to think of all sorts of applications for Eve-type robots. With their ability to open doors and control elevators, tasks like patrolling buildings at night and stocking supermarket shelves spring to mind. Also, helping nurses by bringing drinks and meals to hospital patients. And, in the fullness of time, helping around the home (I’m not going to show Gina this article because she will never stop asking, ‘when?’). One of the interesting things Nicholas told me is that they are doing a lot of work designing their own specialised motors that provide the optimal combination of speed and torque for their particular application. In turn, this caused me to return my attention to the motors powering my own animatronic appendage. Motoring along Have you ever thought to yourself, ‘What is a motor?’ I have. I wish I hadn’t. It turns out that this is a topic of mindboggling complexity. As a start, although the terms are often used interchangeably, engines and motors are not necessarily the same thing. By one definition, engines convert chemical fuel into mechanical force by means of combustion, while motors (a.k.a. ‘electrical motors’) transform electrical energy into mechanical energy. Having said this, some people define a motor as being ‘a device that consumes energy in one form and converts it into motion or mechanical work.’ By this definition, engines would form a sub-category of motors. There are also molecular motors – both natural (biological) and artificial (molecular machines) – that are essential agents in living organisms. If you are interested in learning more about these little rascals, I would strongly recommend the book Life’s Ratchet: How Molecular Machines Extract Order from Chaos by Peter Hoffmann (https://amzn.to/3tK6B6r). For the purposes of our animatronic noggin, we are interested in electrical 55 Fig.4. (above) Each animatronic eye is controlled by two 9g servos (Image: Steve Manley) motors, but there are so many different ways to ‘slice and dice’ this topic that it makes your (human and animatronic) heads spin. For example, we might divide things into rotary motors and linear motors, where the latter is essentially any electric motor that has been ‘unrolled’ so that, instead of producing torque (rotation), it produces a straightline force along its length. I must admit that, when I originally started to contemplate this column, I was hoping to present you with a handy-dandy hierarchical tree-structured graphic that illustrated the relationship between all of the different types of electric motors, starting (perhaps) by splitting things up into AC motors and DC motors and branching out from there. Since that time, I’ve grown to be an older, sadder, and wiser person. I’ve also come to believe that this is a task beyond the ken of mortal man. Suffice it to say that, if you feel daring, perform a Google search on ‘Different types of electric motors’ (you will soon wish you hadn’t). One reference comes at things from a different angle. In his book Motors for Makers: A Guide to Steppers, Servos, and Other Electrical Machines (https:// amzn.to/3N5ucoZ), Matthew Scarpino kicks things off with a nice and easyto-comprehend Motor Selection Flowchart. This starts with a decision symbol that asks: ‘Do you need to control/measure the precise angle?’ There are two options: ‘Yes’ and ‘No.’ If you select ‘Yes,’ you are directed into an action symbol that succinctly says, ‘Choose a stepper or servo motor’ (if you select ‘No,’ you head off into a cascade of options and decisions). To be fair to Matthew, he does note that his diagram is of use only for making an initial assessment and it doesn’t cover all the possibilities. For example, universal motors can operate on both DC and AC power, and if any motor is connected to an encoder or position sensor, then its angle can be measured and controlled. Still and all, this chart does provide a useful starting point. 56 Fig.5. Tower Pro SG92R Micro Servo (Image: Adafruit) Stepper and servo motors When it comes to position control, the two main options are stepper motors (‘steppers’ for short) and servo motors (‘servos’ for short). A stepper motor divides a full rotation into a number of equal steps. Such a motor employs a simple form of openloop control system because it can be commanded (via a simple sequence of discrete pulses) to move through a precise angle and hold at the designated step without any position sensor or feedback. Steppers fi nd myriad uses in things like analogue clocks, 2D and 3D printers, laser cutters, and robots. A servo motor is a rotary (or linear) actuator that allows for precise control of angular or linear position, velocity and acceleration. In addition to the motor, a servo includes a sensor to determine its current position and a relatively sophisticated controller to provide a closed-loop control system. My chum Rick Curl recently sent me a link to a YouTube video showing some rather tasty dual-axis servos used to implement a robotic drummer called Zenbot (https://bit.ly/3xELy6w). For the purposes of these discussions, we are focusing on small hobby servos based on DC motors in which everything is presented in a single small package. However, we should note that servos come in all shapes and sizes, including whopping industrial servos (both DC and AC) which may employ external sensors and control modules. First experiments now in a position to say that I just had a fossick in my treasure chest of bits and pulled out a Tower Pro SG92R Micro Servo (Fig.5), like the ones available from Adafruit (https://bit.ly/3n0ElbY). This little scamp can rotate approximately 180° (90° in each direction). Not shown here is the servo horn, which is a short arm (or pair of arms at 180° to each other) that clip onto the gear wheel sticking out of the top of the servo. These servos are controlled by means of pulse-width modulation (PWM). In this case, there are two parameters of which we need to be aware: the width of the pulse and the period of the signal (see: Fig.6). It’s the width of the pulse that determines the position of the servo’s horn. The 1.5ms shown here will drive the servo to its default (central) position. The period of the pulses (that is, the time between pulses) is less important but, for hobby applications, it’s common to use 20ms, which equates to a refresh rate of 50Hz (ie, fifty cycles per second). Servos may be classed as being analogue or digital. Don’t panic, because these appear to be identical from the perspective of the controller, which doesn’t know or care and sends out the same pulses regardless. The difference is inside the servo itself. An analogue servo employs analogue circuitry to amplify and process the pulses from the controller and use them to drive the motor to the specified position. By comparison, a digital servo contains a microcontroller, which measures and processes the pulses using digital techniques. Each type has advantages and disadvantages, none of which we need delve into here. In my previous column (PE, July 2022), Steve shared some interesting information with respect to the servos we ended up using on our animatronic head, such as the two metal-geared 9g Turnigy TGY-50090 servos of 1. 5 ms 20ms (https://bit.ly/37pEFNb) we use to control each eye (Fig.4). Controller Servo ( e. g. A rduino Uno) On the off chance you wanted to learn something unexpected, the word ‘fossick’ is Australian for ‘rummage.’ Telling you this means I am Fig.6. PWM used to control a hobby servo. Practical Electronics | August | 2022 Fig.7. The Sweep Circuit (Image: Adafruit) Fig.8. Example Sweep Circuit program. Different servos respond to different PWM parameters, although the 1.5ms is always the default position. For example, according to Motors for Makers, some servos will accept pulses from 0.7ms (full rotation left/anticlockwise) to 2.3ms (full rotation right/clockwise) (by ‘full’ we mean the maximum rotation supported by that particular servo). By comparison, according to Adafruit’s webpage, in the case of the Tower Pro SG92R, a 1.0ms pulse width corresponds to a rotation of –90°, a 1.5ms pulse corresponds to 0°, and a 2.0ms pulse corresponds to a +90° rotation. Just to keep us on our toes, different servo manufacturers use different colour schemes for their wires. Common combinations are brown/red/orange, black/ red/yellow, black/red/white, and black/ red/blue. Fret not! – this is easier than it Practical Electronics | August | 2022 seems. The red wire, which always appears in the center, is always +ve (let’s say 5V, although servos using other voltages are available); the black or brown wires are always –ve (let’s say 0V), and the remaining wire is always the control signal wire, irrespective of whether its colour is orange, yellow, white, or blue. As you will see, controlling our example servo is easy-peasy, not least that a Servo library is included with the Arduino’s integrated development environment (https://bit. ly/3O3rIZu). The Adafruit website provides some nice experimental circuits and associated programs. For example, consider what they call the ‘Sweep Circuit’ (Fig.7). There’s no real need to use the breadboard in this case, but doing so will make it easier to migrate to more interesting test cases later. Also, if you happen to have one lying around, it would be a good idea to connect a reasonably large electrolytic capacitor (say 470µF to 1,000µF) between the power and ground rails, thereby helping to insulate the Arduino from any servoinduced power surges, and having the breadboard makes this easy. The control signal to the servo can use any of the Arduino Uno’s digital outputs that supports PWM, which would be pins 3, 5, 6, 9, 10, and 11. We’re using pin 9 in this example. An example sketch (based on the one offered by Adafruit) is shown in Fig.8. Our first step on Line 1 is to include the servo library. On Line 3, we create a servo object. In this case, we’ve called it MyServo, but any legitimate (nonkeyword) name will do. On Line 7 we use the attach(pin) method to attach our servo variable to a pin (digital pin 9 in this example). Note that there’s another way to do this, which is to use attach(pin, min, max), where min defines the pulse width, specified in microseconds, corresponding to the minimum (0 degree) angle on the servo, and max defines the pulse width, specified in microseconds, corresponding to the maximum (180°) angle on the servo. Inside the loop() function we have two for() loops. The first sweeps the servo from 0° to 180°, then the second sweeps it back from 180° to 0°. The 15ms delays between each step are there to give the servo time to respond and move to its new position. Both of these loops use the write() method to specify the desired angle in degrees from 0° to 180° (in the case of a continuous rotation type of servo, writing a value of 0 would set the servo to rotating at full speed in one direction, a value of 180 would set it to rotating at full speed in the other direction, and a value of 90 would result in no movement at all). Make sure you attach a horn to the servo before you set this program running or you might not even realise that anything is happening. If you’ve never used a servo before, then seeing the simple back and forth sweep motion presented by this program will bring a little smile to your face because it will make you realise that you’ve just flung open the door to a world of motioncontrol possibilities. Next time As exciting as all this is (assuming all this is new to you), we’ve really dipped only the tips of our toes into the servo control waters. Next time, we’re going to consider some different approaches to control a bunch of these little rascals, like the seven servos we’re using on our animatronic noggin. Until then, as always, I welcome your questions, comments, and suggestions. 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 57