"We can dance if we want to, we can leave your friends behind
Cause your friends don't dance and if they don't dance
Well they're no friends of mine" - Safety Dance, Men Without Hats
Don't let your robot friends get left behind.
Music + Beat Detector + IR Blaster + Simple Robots = Dancing Robots
For Arduino Day 2018, MakeIt Labs held a Build a Bot class in the morning followed by an afternoon of robot hacking. The grand finale was a Robot Dance Party, complete with a disco ball, fog machine, strobes, lasers, and of course... Dancing Robots!
These little robots are no strangers to parties. Hackaday even caught one dancing on the table (and passing beer) at the 2017 BAMF meetup. Being simple creatures, they don't have a really good sense of rhythm. You can't blame them, they have no ears, but they do have an IR receiver. To help them get their groove on, we hacked together a music beat detector (Arduino Uno + MSGEQ7 Graphic Equalizer Chip + firmware) and blasted out IR codes synced to the beat. A little firmware magic on the robots and... Dancing Robots!
We're going to capture the current state of the project (so we actually have all the info in one place, and not on random napkins), fix the problems we ran into, and then make some improvements.
Since this happened to coincide with the Robotics Module Challenge of the 2018 Hackaday Prize, we're also going to distill the breadboard hacks and firmware into a simple beat detector module so others can host their own robot dance parties.
We've been working on the "less hacked" version of the Beat Blaster design. Originally, we were going to take almost exactly what we did on Arduino Day and just turn it into to PCBs - one for the Beat Blaster and one for the IR Panels. Keeping things simple, we were leaning towards either sticking an Arduino Nano on the PCB, or dropping an ATMega328 right down.
And then we started thinking about other features we might want to add (yes, the bane of all projects that you're trying to complete quickly... but you know what? This is just for fun! What the heck...).
Instead of an Arduino Nano, we decided to go for an ESP32. Our feature creep list included:
a) could also blast the beat and frequency info over UDP via WiFi for smarter robots b) could serve up a spiffy web app from the ESP32 to adjust parameters, look at the spectrum, etc. c) while we have a web app, could add “show us your moves” buttons to the app to send dance move commands d) somewhat smarter robots could also register with the beat blaster, so we can do things like “hey robot X, show us your moves” e) opens up a whole set of other possibilities for dance party accessories… connected lights that listen to the music (via UDP), synced strobes, robots with controllable freakin’ lasers on their heads, etc.
So, that's where we're at. We have block diagrams and description below.
The audio interface will be stereo and we'll have two complete paths into the ESP32. One of the issues we had in the original design was getting the sound levels just right. With this design, we'll include digital level control and be able to monitor the levels. Alternatively, if the ESP32 turns out to be fast enough (which we think it will be), we might just decide to do digital processing of the analog signals directly and eliminate the MSGEQ7 chips. For now, the design will support both options.
DC power input will still be +12V. This will pass through a poly fuse and out to the IR Panels. A switching regulator will generate +5V from the +12V input and +5V will also pass through a poly fuse and out the IR Panels. A +3.3V linear regulator will take care of our local power needs.
For the IR signals, the IR Code and IR Tone will still be generated separately and combined with an AND gate. Instead of sending pure logic levels out to the panels, an RS422 differential driver will be used. This gets us a bit more noise tolerance and since RS422 receivers can be multi drop, we should be able to daisy chain panels (instead of the original star topology).
Using RJ45 connectors and generic ethernet cables makes for simple hook-ups.
Depending on whether or not we use an off the shelf ESP32 dev module, or if we drop an ESP32 WROOM module down raw, a USB to Serial converter may be required.
Finally, we have the IR Panels. Each will have a pass through RJ45 to make daisy chaining panels easy. Local +3.3V is generated from +5V (doing this is better than trying to send +3.3V around to all the panels... it will handle minor voltage drops and noise better).
The LED circuit is similar to the original with the addition of the RS422 receiver. +12V passes through a poly fuse, current limiting resistor, and 8 LEDs in series (7 IR LEDs and 1 Green LED so we can see that the panel is working). The MOSFET switches the LED chain to ground based on the received IR signal.
Since RS422 should be terminated, the last panel in the chain will either need a terminator installed in the pass thru connector, or, we'll design a terminator on each board that can be connected via a jumper.
That's it for now. The next step is to get some hardware designed so all the software people on the project get to have some fun!
Release v0.0 is a snapshot of our project as built/written for Arduino Day 2018. Please be gentle... it was a fast hack session and not pretty. We had to really suppress the desire to clean things up before posting.
In true maker space spirit, we hacked the beat detector and IR blaster prototypes together over a couple of evenings. For the prototype, we used DF Robot's breakout board for the MSGEQ7 graphic equalizer chip.
This chip is pretty cool... it contains seven bandpass filters with peak detectors, and an analog mux. You send it a reset pulse, then a series of strobe pulses. With each strobe, the analog mux passes the output of one of the seven peak detectors.
Using an Arduino Uno, we hooked up two digital outputs for Reset and Strobe, and one analog input to read the values from the filters/peak detectors.
The idea is, with some firmware smarts, we should be able to look for the music's beat down in low bands (especially if we pick the right music!). This was enough for us to start, and yes, we could probably do it with a simple low pass filter. But... we liked the possibility of doing something creative with the other bands.
Here's the "napkin sketch" of this section:
Ignoring the firmware magic for now, and assuming we actually can find a beat, the next hardware task was generating the IR codes and blasting them out to the robots. As we mentioned before, the 2020 Bot has an IR library that works well with its remote control, and includes matching transmitter code. So, we decided to simply use that library and generate a button press for every beat.
The IR library uses two pins for transmission. One generates the 38KHz tone, while the other performs the code modulation. For the 2020 Bot, these pins connect directly to each side of an IR LED through a resistor (note that the 2020 Bot does some funky stuff with open collector driving). In our project, we want the two signals combined so we can send them to remote IR LED panels. This is done with a 74HC00 NAND gate.
Each LED bar is powered from 12V. The IR LEDs we had kicking around had forward voltage drops of about 1.4V. At 12V, we could drive 8 LEDs in series (8 x 1.4V = 11.2V), dropping through a 50 ohm series resistor. This gives us LED current of 16mA (50 ohms / 0.8V).
Our parts cabinet had a boat load of IRF740 N-Channel MOSFETs which are way overkill for 16mA drive, but they'll do the job.
We added extra bulk capacitance around, figuring the panels would be wired at a distance from the power supply.
Here's the prototype IR modulation combiner and LED strip schematics:
And, here are pictures of our prototype system:
Arduino Beat Detector and IR Modulator:
LED Panels (note that we used 7 IR LEDs and 1 Green LED, that way we could see if the panel was working):
It's hard to have a robot dance party without robots. The bots we used were the 2020 Bot (2020Bot.com), an open source robot design one of our members developed. All the sources for parts, instructions, and links to libraries and demo code are posted on the website. We've had a bunch of 2020 Bots built at MakeIt Labs classes, and even a couple dozen built at Bay Area Maker Faire in 2017.
The robot isn't that complicated. Check out the diagram below. The key component for the dance party is the IR receiver (available on Amazon here, but also many other sources). This is your standard IR receiver that expects a 38KHz modulated signal - search the web for VS1838. We used the 2020 Bot's IR library to send codes compatible with the 2020 Bot.