Introduction: ATtiny & IR Remote Control Wiebelbot
Put it next to your TV and it shows its happiness each time you use your remote (This way at least someone gets some movement). Or you can have it dance to the signal of your sound system.
It's USB powered, so you can connect it to a USB port on a modern TV or any other USB type power source, so you can put it anywhere and use almost any remote to make it move at your will.
I made it as a present for a colleague and friend (she likes nerdie things). I called it Wiebelbot, as in Dutch (my native language) “wiebelen” means “to wobble”. The names wobblebot and wobble bot are already used by a number of completely different projects.
The simple and cheap remote control setup used can be applied in animatronics and many other applications. I estimate the parts and materials cost less than 10 euro in total (I made it completely out of stuff I had laying around). The challenge when making the Weeblebot was in keeping it small. Building it somewhat larger, based on a larger ball would make things a lot easier. This Ible presumes some basic electronics and soldering skills. If you have some basic experience with Arduino (like me) it could make a great first ATtiny project.
Many thanks for the nice comments and the votes!
Step 1: Parts, Materials and Tools
An ATtiny 45 or 85 microcontroller
An IR receiver module tuned to the 38 KHz modulation frequency as common for TV remotes (similar to this one)
A small servo, for the ping pong ball scale at which I build the Wiebelbot I used a HobbyKing 1.7g ultra micro servo
A capacitor, at least 22µF (I used a 100µF one)
A length of highly flexible wire (I used 0.1 mm2 wire)
A male USB connector plug (I made one from strip board, similar to this Ible)
An LED (any, I used a common 5mm red one)
A 220 Ohm resistor
Optionally, some shrink tube fitting the LED.
Construction and Finishing Materials
A ping pong ball
Some balsa wood scrap (I used 2 mm thick balsa sheet)
Some weighting material (I used 1 mm lead sheet, but some steel washer s should do it too)
Some sheet material to make the head (I used 0.5 mm polystyrene sheet, but cardstock would be great too)
Further decoration material, keeping it lightweight: For the arms I use a couple of curtain rail eyelets, for the second eye next to the IR receiver I used a broken 5 mm LED.
Tools and Adhesives
Soldering Iron and solder for small scale work
A drill, a 2 mm and a 5 mm drill bit
A 19 or 20 mm drill bit plus a press drill or alternatively bent scissors (not shown, I will explain the alternatives)
Marker pen, sanding paper, hobby knife….
Super glue, optionally some hot melt glue
A setup to program the ATtiny (I used a setup as described here)
Optionally, a solderless breadboard and jumper wires and tape for testing
An USB power source and a remote
Step 2: The Remote Control Setup and Code
How it works:
The ATtiny microcontroller checks the the signal from an InfraRed receiver module. That module filters. The IR receiver module automatically takes care of limiting the reception of signals modulated to 38 kHz (or close), typical for TV remotes and related appliances (Actually, when taking pictures I noticed it also reacts to a flash).
As long as no more than 90 milliseconds have passed (the longest interval occurring in common IR codes) the ATtiny sends a signal to the servo making it move from left to right. The servo movement shifts the centre of gravity, making the robot wobble.
While experimenting to shrink the Zappelin Arduino project to an ATtiny I made a simplified remote control setup. When any IR signal is picked up i.e. without checking any code to determine which remote is used or which button is pressed the servo performs an action.
This 1 function and non-discriminatory remote control setup obviously has important limitations, but it also has it uses, like the Wiebelbot as a television companion.
I used the Arduino IDE and an Arduino Uno to program the ATtiny as explained very well here. The core I used is this one.
The program (sketch) is added to this page as a zip file. The circuit diagram is repeated in the pdf.
How to get an ATtiny read the signal from an IR receiver module I learned from this fascinating project.
Controlling the servo from the ATtiny is done with this very valuable piece of library code: Servo8bit
After downloading, copy the Servo8bit library under your Arduino Libraries folder. An important warning when using the), is to keep the example out of the libraries. Otherwise it gets added to the uploaded code and executed on the ATtiny after one cycle of your own program. Call the Servo8bit library and use the functions as shown in the added code.
When using this library, the delay function is inactive (has to do with double use of timers). Therefore I used the millis and micros function to control timing. I used the micros function with future projects in mind, projects attempting for a better interaction between IR decoding and servo commands. With the Zappelin project, we quickly ran into limitations in that area. In this Wiebelbot project there isn’t any IR code interpreting done yet, but it’s a start to explore an alternative approach.
Step 3: Electronics Assembly
The circuit is built up in freeform around the ATtiny with its legs bend flat. The servo, ATtiny and capacitor make the main moving mass to make the Wiebelbot wobble.
To be able to bring the centre of gravity as low as possible the lower flange of the servo is cut off. The servo leads are separated and are used to both connect the servo to the ATtiny and connecting this assembly to the fixed part of the Wiebelbot.
About 2 cm from the servo the wire insulation is pulled apart without breaking the wire (I did that with my nails). The bare parts of the brown and red lead are soldered to the GND (leg 4) and VCC (leg 8) of the ATtiny and is kept continue to the connector plug.
The orange servo signal lead is cut ant soldered to leg 6. The other end is soldered to leg 3 so the plug can be used to connect the IR receiver module (check the datasheet for your receiver module as different pin configurations exist).
The capacitor is soldered in parallel to the GND (leg 4) and VCC (leg 8) of the ATtiny (respecting the capacitorís polarity). The circuit works without the capacitor, but I noticed the reception range becomes a lot smaller. Generally a minimum of 22µF is recommended. In principle it should be put as close to the IR receiver module as possible, but the setup used worked fine. I did use a 100µF capacitor as I had that lying around.
A 220 ohm resistor is soldered to leg 5 and the other end of that gets a thin flexible wire that will be running to + leg of the LED
The ATtiny and the capacitor are superglued to the servo sides as shown. The leads parting from the assembly are also glued to it for at least half a cm. This way the flexible wire takes up the forces when moving, not the soldered connections.
I tested the assembly at intermediate stages, as shown.
Close to the plug the main power leads are soldered to the red and brown wires (again after separating the insulation), keeping some distance between the bare metal. It is very important to use highly flexible wire to minimise the hindering of the wobbling movement.
An extra wire is added on the GND lead, to connect the - leg of the led.
Step 4: Mechanical Assembly
The hole in the ping pong ball can be made as shown here, but this time, I carefully drilled it. I first practiced on a discarded ping pong ball first.
I kept an eye on the seam running in the ping pong ball, and positioned it so it doesn't show up when the LED shines through.
As the material flexes, even when working very slowly, a perfectly round hole is hard to achieve. But that is actually not needed. As long as you can get the servo assembly inside, it’s OK. If that is not the case, some sanding quickly solves that.
From 2 mm thick balsa wood I cut and sanded a lid fitting the hole.
I temporarily added a slat so it doesn’t drop into the ball. A hole is made that is just large enough to pass through the connector plug (Sorry for the bad picture).
The servo horn is extended with a 2 mm thick and 4 mm wide balsa strip, glued and in place and soaked with superglue to strengthen it (letting it set on some anti-stick paper).
With the horn mounted on the servo, the assembly is dropped in the ball to check the needed length of the extension. After cutting it to the marked length, minus a couple of mm, it is glued under the lid, near the back edge. The right angle is strengthened with a small extra piece of balsa
The plug is run through the hole. The LED is glued in place and soldered to its leads.
A 2mm hole is drilled near the bottom, at the back to pass through the power leads (connected to a USB connector plug).
Testing showed both the bottom of the ball needed some extra weight to keep it upright when the servo is in the middle position. The moving part also needed some extra weight to keep it wobbling well. I used some pieces cut from 1 mm thick led sheet (as led is bad for you clean your hands and tools carefully afterwards. If you want to avoid it you can try and use other flat metal parts like steel washers). With this weight added I needed to reposition the servo horn slightly to have the Wiebelbot standing upright with the servo at "neutral".
Step 5: Finishing
The arms are made out of curtain rail eyelets. I cut them to make pincers and superglued them to the sides of the ball.
The balsa slat is exchanged for a vertical support for the "eyes". One of the eyes is the IR receiver module the other is a broken down LED, blackened with permanent marker. The LED is shielded on its sides with some shrink tube (or you can use black tape). This is to avoid the LED light projects a shadow of the moving mechanism on the surface of the ball. I prefer the inside movements do not show on the outside, making the way it wobbles not that obvious.
The assembly is put in the ball and after checking the internals move freely, the lid is glued in place (I used hot melt glue), without getting any glue to far over the edge of the hole.
For the head I made an open “box” from 0.5 mm polystyrene sheet. The sheet is cut with a hobby knife and the plies are first scored with the back of the knife. The holes for the eyes are drilled with some scrap wood as temporary backing. The head actually turned out to high and to heavy, so I lowered it, solving both problems. Checking the position of both eyes, the head is glued on top of the balsa support.
With, on the inside, enough spare length to be able to take out the mechanism, the power leads are glued to the ball on the outside. Superglue is added over just a couple of mm of the wires coming out of the hole.
When putting the Wiebelbot in position for action, it is important to aligne the power leads at the back so it stands upright when the movement is not activated. Even highly flexible leads significantly influence the equilibrium.
Step 6: Further Developments
The servo speed could be trimmed to the pendulum characteristics of the Wiebelbot. But I actually like it that the misfit gives some irregularity to the movement.
A battery operated version should be possible with a small lipo as shown. A 3V coin cell is not suitable as the servo refuses to work at 3V (as most servo's do).
For an easier to build and more robust version I would go for a slightly larger version, where all electronics and the servo are fixed to the body and only a dumb mass is hung to the servo horn. I’m not sure if a good enough ratio between fixed mass and moving mass can be achieved, but it seems like worth a try.
Obviously it would be interesting to expand the code with really reading the IR remote codes and acting upon that, but that is something for another project…