WHAT DOES HYPNOTOAD WANT?
Hypnotoad is kind of complicated. When you’re happy, he’s happy. When you’re sad, he’s sad. When you and a friend are both happy, he’s ecstatic! Just both don’t be mad. Hypnotoad wants to read your mind, and he insists, everyone must be happy. Remember…
Hypnotoad demands harmony…
This froggy character is a culmination of two ideas. The ambition to create a tandem biosensor that communicates back and forth between you and a partner, and a creature that mediates between two helplessly less psychic humans.
WHAT IS HYPNOTOAD MADE OF?
Yard Frog: Hypnotoad was upcycled from an abandoned corner of my mom’s front yard. Neglected and alone, for nearly twelve years, this ancient frog gained timeless wisdom and psychic powers, through a period of extended hibernation and meditation. As a partially cybernetic, water-permeable superbeing, he needed some functional repairs.
He came equipped with a micro controller, a weather corroded battery drawer, a raspy speaker, and an irreparably defunct motion sensor. Or light sensor. Or soul sensor. The mysterious lens lodged in his mouth was caked in years of mud and would not fire.
Adafruit Neopixel ring: I daisy chained a power-hungry (960mA) ring of 16 addressable RGB LEDs, with sturdy throughputs, to a 7 pin, possibly cloned Neopixel disk, with flimsily connected, flat contact pads. (I destroyed 3 of these disks just lightly applying solder)
Pulse Sensor – Earring style: An open source, optical pulse sensor created by ITP and USCD designers, Murphy and Gitman, that collects your pulse, based on the penetration of light through your ear lobe or finger, relative to the amount of blood coming and going, moment to moment. This sensor differs from typical heart sensors, which detect heart rate through electrical muscle activity near the heart. Unfortunately, it is sensitive to ambient light, and will always return a signal. Testing was originally done on SparkFun’s dry electrode heart sensor, which had 2 extra wires (Lo+, Lo-) designed to filter out junk data when the electrodes lost contact. It was dropped because it dropped too much data, far too often.
Grove GSR: Originally based off of lie-detector polygraph technology, this arduino-specific sensor measures electrodermal activity to calculate moments of stress and excitement, through changes in skin conductance (AKA Electro-Dermal Activity). Testing was originally done on a Bitalino™ micro controller sensor board, but the EDA data that Bitalino generated, rolled through broad changes of stress slowly, while Grove’s sensor picks up moment to moment changes.
Arduino Micro Pro: I tried out a variety of micro pro microcontrollers, including two clones (Funduino and __), a Trinket, and the original variety. Other than a few offset Analog pinholes, and messily scattered labels that were only visible from the bottom, the cheap micro pro clones worked exactly like the real deal, which in turn worked just as well as their more popular cousin, Uno. The main difference from an Uno is that Micro comes pre-soldered with male pins, which you’ll need to mate to a breadboard or female jumper cables to make use of. This costs you some of the size that Micro saves.
Green EL wire: Electro luminscent wire, that apparently gobbles a dangerous 120 volts straight from the wall, if your microelectronic store doesn’t remind you to buy an inverter. Buy an inverter. Just do it.
Woodcut letters, letter stickers, foam core boards, a cafe table, folding chairs, 3 sizes of hobby boxes, fake pond flowers, green modelling clay, green glitter paper, green aquarium stones, green mesh ribbon, green foam frog eggs, green and black fingerless gloves, un-sewable green scaly embossed cowhide, a tiny purple dog cape.
Varspeedservo Library: This library let me control two servos independently, and most importantly, run them in parallel with a simple True/False parameter. I wish I could say multithreading other components on Hypnotoad’s Arduino was as easy.
Adafruit_NeoPixel Library: This library lets you control multiple strips of neopixels from the same controller, as long as you create unique objects for each one, or daisy chain them all together, and tally up your total LED count.
Pulsesensor.com’s Interrupt: Not a library per se, the script on the pulse sensor’s website is indispensable, if you’re not familiar with introducing interrupts to your main script. I’m not, and I didn’t fully understand the components of the interrupt, so I discovered the hard way that anything you add to these functions, out of logical necessity, will run much faster than anything else. It interrupts the main Void Loop every 2 milliseconds.
(Functionality & Logic)
Hypnotoad responds differently, through a series of short and quick ribbits, relative degree of rotation, and glowing eyes, to express what he likes and dislikes.
This rough diagram shows the three options I had for arranging one or three wearables, with either concealed cables or a bluetooth module in every device. In the second option, both displays are slaves communicating to the master creature controller by bluetooth, and between the untethered wrist sensors, and pendant controllers
See Hypno in action (IMG_0419)
(The Build Process)
I spent weeks testing all of the bio sensors, and trying to daisy chain the cheap neopixels to the 16 pixel rings. I wired the necklace suspended rings directly in front of a micro pro, and ran signal, ground and voltage down arm-length cables to the pulse sensor and GSR finger cuff electrodes. After heat shrinking the cables in place, I realized I was going to need to run cables back up to the sensors and ring instead, coming up from a single, hidden controller board under his throne. This was necessary, as networking 3 arduinos of alternating roles was more trouble than controlling everything from one.
Ultimately, the necklace’s and Arduino Micro Pro should fit into a case that look like this…
I throttled the neopixel’s activity to stay within the Arduino’s power limitations, and turned both displays into separate instantiated objects of the same Adafruit library
The next step was completing the creature assembly. I knew I was going to:
- Fix, replace, or augment the frog’s internal motion sensor
- Make the frog jump
- Add lights, servos, and metal components to the frog chassis, adding to its weight
I had to figure out a way to rotate the frog to look at you, without exceeding the amount of torque the servo could handle before breaking. I bought a ballbearing assembly, sandwiched between two plates, and bolted the frog to existing holes on the plate, that happened to line up with speaker holes on the frog’s base.
I picked a small round servo blade that could pass through the center of the ballbearing assembly, protruding enough to clear the top opening. I bolted a rebar across the top assembly plate, and drilled two holes into the sides of the plastic blade to mount to the rebar and then screwed the blade into the servo itself (it needed two so that the blade wouldn’t unscrew itself).
On the bottom of the ballbearing assembly I attached two C-shaped metal bars, with only one screw each, to allow them to turn freely. Then I drilled holes in the side, attached springs, sandwiched my servo between them, and tensioned the springs to each, across the servo, with two springs. This kept the servo from twisting itself out of alignment, while still being mounted independent of both the frog and the case the frog would sit on. It also gave me back up space in case I needed to change the servo to a smaller or larger size later on.
With the mounting assembly finished, discrete enough to hide under the frog, but strong and modular enough to take any load, any servo, and mount anywhere, I moved on to the second servo.
I mounted the servo inside the frog, on top of its battery drawer, fixed a v-shaped lever to the servo blade, fed the second arm through another hole in the frog’s base, and made a simple kick for jumping.
I bypassed the frog’s previous power entirely, and wired directly to its board. I considered doing a back and forth conversion of analog to digital and digital to analog recording of a frog Croaking, but I knew the frog had a prerecorded ribbit sequence. Sadly, the motion sensors were clogged with mud, and damaged somehow. I debated splicing wires in from the arduino’s digital pins to the output of the two sensor wires, and faking a signal, but there was a chance that the motion sensor might produce a specific amount or pattern in voltage.
I realized the frog made a special croak, independent of the sensor, every time he boots up. So rather than messing with the sensor, adding a waveshield, or tackling the existing board and processor, I decided to exploit Hypno’s boot cycle. All I needed to do was briefly cycle power for single ribbits, and give him a lengthier cycle of power to do his full croak. This provided two sounds for two different contexts. At slightly below nominal voltage, I found I could modulate and deepen his croak opening up a third possible croak.
The frog had plastic eyes, with unretractable pegs blocking a perfectly usable hole for LED eyes. I melted through this with my soldering iron, daisy-chained two single LED Neopixels, and gave Hypno indicator eyes.
I built a small protoboard inside the frog’s body, to combine the grounds and voltages of the jump servo, eyes, and croak, feeding it out the bottom with a ribbon, and through a safe hole in the ballbearing plates.
I used the varspeedservo library to create three motion profiles.
- The frog turns and looks at the most anxious person in the pair
- The frog points in between the two friends and waggles if both people are upset (his eyes glow red, and he stutters short croaks)
- The frog points in the center of the two friends and hops up and down if both people are happy (his eyes glow green, and he does his full cycle of 3 uninterrupted croaks)
The jumping mechanism worked fine, but required long, unanchored bolts to go into Hypno’s chassis. I considered grinding the last half of the bolts down, so that he couldn’t snag his bolts on the (speaker) mounting holes at the top of a jump.
My first, and largest coding hurdle, passed on from the Golf project, was communicating from necklace to necklace, and between necklace and frog by bluetooth. I already used bluetooth directly, from arduino to computer IDE, in previous projects to upload scripts wirelessly and print data. Networking three devices, to both send and receive data from one another, alternating AT roles between master and slave… I decided to avoid this early on. It already failed once with the HC05 modules for Golf.
The second option involved combining four sensors, two vibrating motors, two ring displays and a frog display, two servos, and the croak, all on the same board. This worked well up until I realized I had created my fluttery light show with fixed delays, and an interruptor timer for the heart sensor. Timing two pulse sensors and performing the inter-beat calculations in the same interrupt, and timing two arduino displays, proved too difficult to program procedurally without creating my own classes. I needed to run two instances of the same class, with independent timers, at the same time: multithreading. Arduino isn’t meant to do multithreading.
A third option came to me. I could compare the two heart rates in their raw data, average or select from them conditionally, and just display one rate. This only needed one interrupt service routine, and would output the same values to both necklace. Even if I couldn’t time both separately, I could already treat the colour of the necklaces separately, letting me indicate the dominant beat.
Sadly, my script broke. The previously functional interrupt suddenly decided it was “not declared in this scope“. I debated returning to a single display, as I had already accomplished one before, but I hadn’t saved enough incremental versions of my script between major changes, to recover all of the working functions I had added.
Hypnotoad awaits the day he can sit and judge us.
Millis: The death of multithreaded timing in Hypno’s code came from using a variable delay, with the interval matched to the interval between real beats. The next iteration will include an increment with identical timing criteria for the first 12 loops, and a variable time condition to meet to restart the pulse. Both displays can have their conditions nested in the same loop.
Corrosion: Determining why the frog wouldn’t power up on its existing system took multimeter testing from battery terminals to motherboard (the battery drawer terminals had corroded in the rain)
Copper Traces: I spent more time than necessary trying to learn how to fix lifted solder pads. I scraped, sanded, and alcohol-washed the exposed metal, then tried using plumbers solder and other metals to wet the bare copper. I found an obscure and offbeat youtube video about replacing traces with rare conductive epoxy, and not so rare copper sheets. Then I gave up.
Voltage Shortages & Simple Solutions: I kept getting an inadequate 2 volts of power from the digital pin outs on Arduino, trying to feed Hypnotoad’s hardware 5 or more. I spent half a day failing to step it up, with every combination (or combined rating) of diodes, capacitors, and transistors. I went as far as using a reed switch, supplying 5 volts directly, with the 2V digital pin powering the switch, and still couldn’t trigger the delivery of 5 volts I needed out the other end. It turned out I was missing the PinMode Output command; a one minute fix.
Hypnotoad’s Throne: Figuring out how to rotate the frog without breaking the servo or snapping a cord, or mounting the entire assembly off of the fragile servo blade, was tough. The mounting assembly alone, took 2 days to figure out, build and calibrate.