Last weekend, Marcus of interactive-matter and I, gave a small introduction into internet of things and ambient devices at the Good School. The idea was to have two devices that show the current volume of two terms on twitter, e.g. love against hate. The demo should show how easy it is to connect the physical world to the internets. Marcus did the software part, so if you are interested in that, visit interactive-matter. I did the hardware part, if you want see that, just read on.
So what is needed to build something like that?
- Arduino Board with ATmega328
- Ethernet Shield
- RC Servo
- Hot glue (a lot)
- Photoresistor, LED and two resistors, 10 kOhm and 100 Ohm
- Protoboard, small
First you have to hack your servo for continuous rotation. A standard servo rotates only from 0 to 180 degrees. You have to hack it so that it rotates continuously forward and backwards. There are many different servos out there and as many instructions how to do that. Just use google. For me it was enough to separate the potentiometer from the servo arm. Important is, that you can still control it like a servo afterwards. That means you still have the red (+), brown (-) and orange (pulse) cable to control the servo. You should also write a small Arduino sketch to check where the motor stands still.
Now cut a servo holder out of the cardboard and glue the servo onto it.
Glue the holder to some cardboard as basement. Then build a barrel out of coasters and cardboard tube. Cut small holes in one of the coaster. These holes are part of the light barrier to count the rotations. I cut only two holes. Less precision and less work.
Then glue the barrel on the servo.
Next we need the light barrier. It consists of a light dependent resistor (LDR) or photoresistor and a LED. Both need a an additional resistor in series. The one for the LED is for limiting the current. It is around 100-200 Ohm, depending on your LED. The other one is to form a voltage divider with the LDR. My LDR has a resistance between 2 k and 50 kOhm. I chose 10 kOhm. The connect the voltage divider to an analog port of the Arduino. Place the light barrier beneath the barrel, so that the LED shines through the holes onto the LDR.
Next, I wrote a small sketch to test the light barrier. It made the servo turn and tried to detect the light flashes of the light barrier. And it worked!
After integrating the software part with Marcus, this is how it looked at our tiny booth.
After all it worked very well and showed, what we wanted to show.
Connecting things to the internet is easy.
Although, there is always room for improvements. After a couple of hours, one of the servo motors began to turn, even if it shouldn’t. And as there is no longer any direct feedback, only through the light barrier, it turned half, noticed that and turned back. I had to re-run the test sketch to find the new settings for it’s zero point. Next time, I would use a) stepper motors or b) a better light barrier, which could detect rotation direction and more holes.