Spoka Pt. III – Choosing current limit resistors & color mapping
I was just realizing that I didn’t put values in for the LED current limiting resistors on the schematic, so I thought I would add a little detail regarding their values and how I chose them. I decided from the start to limit the current through each LED to 15 mA. Each PIN on the AVR can source 40 mA so no problem there, but the entire chip can only source 200 mA total. 7 LEDs X 15 mA = 105 mA. Should be no problem. Plus room to spare when the device is AC powered.
First and easiest was the red. I placed my meter in diode check mode and measured the voltage drop across the LED (Vf) as 1.74V. Measuring the battery output as 3.8V, we get a margin of (3.8-1.74=2.06V) which must be limited to .015A. Dividing the two we get (2.06V/.015A=137Ohms). Putting a 220 and a 330 in parallel gives me (220*330)/(220+330)=132. Close enough.
The blue and green LEDs had too high of a Vf for my meter to read in diode check mode. I knew however that the blue LEDs in the original circuit had a 20 Ohm resistor, so I figured that anything larger should be OK, so I scrounged around and found some 47 Ohm resistors. I soldered these to the LEDs and applied the power, then used the meter to measure the voltage across them. I got 3.16V for the green and 3.07 for the blue.
Green: (3.8V-3.16V=0.64V) (0.64V/0.015A=42 Ohms) Just leave in the 47 Ohms.
Blue: (3.8V-3.07V=.73V) (.73V/.015A=49 Ohms) Again, just leave in the 47 Ohms.
Worst case voltage should be 4.8V when the AC is plugged in. This will give (4.8-1.74)/132= 23mA for the red, (4.8-3.16)/47=35mA for the green, and (4.8-3.07)/47=37mA for the blue. All within the per-pin limit of 40mA. Total output would be (3*23)+(2*35)+(2*37)=213mA. Hmmm, I wouldn’t put out a production unit with numbers like that, but for a hack, it’s not too far off.
I was explaining to my wife the kinds of things I could do with this when it is PC controlled, like changing color according to the speed of a download. This reminded me of an article I saw a while back, “Rainbow LED Indicates Voltage with Color.” This article gives a nice mapping of value to color for the range of 0-255, but it is centered around 128. In other words 128 gives black (all off), <128 gives bluish tints, and >128 gives reddish tints. This might be handy for some things, but not for others. So I did some research on “color scales” and here are a few interesting links:
http://www.ks.uiuc.edu/Research/vmd/current/ug/node76.html
http://www.cs.uml.edu/~haim/ColorCenter/ColorCenterColormaps.htm
Spoka – Part II
(Continued from previous post..)
After removing the LEDs, I marked the outside of the shell to indicate where the eyes and nose were on the rubber cover. Then I modified a small prototyping board to fit into the space, aligning the eyes with the marks made previously. (Notice that the marks are on the same side of the shell as the hole for the plug. Whoops. I had to redo them on the other side)
Then wire the new pcb up, program it and install in the housing for a test (notice my chip-clip programming adapter. It’s handy)…
Red Green Blue White Mouth
Spoka project – Begin
I was at Ikea the other day (they just built one in town, so i get to go all the time) and saw a rechargeable nightlight that I thought would be cool with some RGB LEDs. As I was working on the RF link yesterday, I realized that I could make a wireless, pc-controlled RGB LED light. So I headed over and picked up a Spoka from Ikea. This thing is just begging to be hacked. It comes with a 4.8V 400mA wall wart, and an internal 3.6V 550mAh NiMH battery. The silicone rubber outer cover diffuses the light nicely.
Once you get the plastic shell out of the silicone rubber cover (it takes some work), remove the bottom by releasing the tabs on either side. Then split the shell by releasing the tabs at the top (circles), and prying lightly. There are two alignment posts on each side (arrows) that are a snug fit.

After a little circuit tracing, I had the schematic:
I should be able to take out the LEDs and place my circuit in the same spot in order to keep the battery/AC/rechargeable portion working.
I am planning 2 RGB LEDs (That’s all I have at the moment) behind the eyes, and a red LED behind the mouth. I’ll use a small AVR (maybe a 2313) and the MirfV2 with a ceramic chip antenna for the RF.
Watson, come here. I want to see you!
I finally managed to send some data over the RF link. Somehow I managed to break the printf function, so I only saw the data on the scope as it clocked out of the transceiver on the SPI bus, but it was the correct data. Here’s a hint if you are using the NRF24L01 chip. Go to the Nordic website and make sure you have the latest datasheet. There is a step by step guide to the minimum config for enhanced shockburst mode. Once I had all of my generic SPI problems worked out, it just fell into place. Now to wrap it all up into a nice library and install it on a robot!
P.S. If the title didn’t make any sense, try here. Be sure to check out his notebook.
Reading the Status Register
After playing around with the idea of getting an SD card running in order to get enough storage for the data structures described in my last post, I decided that it would be better, if not neccessarily easier, to get an RF link up and running and prototype the learning algorithm on the PC. So I pulled out the Mirf-V2 that I have bought from Spark Fun for just such an occasion. After perusing the forums for a while I realized that this is a tricky beast to get running, but it should be worth the effort. I also came to the decision that I am not going to hurry, but instead I am going to enjoy the process.
Knowing all of this, I began programming the base unit that will connect to the PC and convert serial to SPI for the Mirf. I built this board almost a year ago, and it has an ATMega8, a MAX233, a 7805 and a Mirf. I had a little trouble getting the SPI working, but using the scope, I managed to figure out the problem.
Finally knowing that I would need two to tan.. er send data, I wired the Mirf up to an ATMega128 breakout board that I also got from sparkfun. Tomorrow I can start writing code that will make the ’128 board send a packet continuously, and receive it with the Mega8 board.
More character creation ideas
Here are some more links to ideas about creating interesting characters, this time from the game industry. Some of these links require a login to Gamasutra, a game developers website. If you don’t have an account, you might want to consider getting a free one. There is a lot of good information regarding AI, map making and following, etc.
Building Character: An Analysis of Character Creation
Character Development techniques in Games
Anticipatory AI and Compelling Characters
Making a robot more “interesting”
I have been trying to make my robot Flik into a pet for my desk at work for a while now. My first thought was “How do I make Flik have character? A personality?” I realized that animators have been giving inanimate objects personality for years, so I started there. Here are some links that I turned up regarding how to give “life” to a drawing…
Principles of Animation: Notes from Ollie Johnston
Tricks to Animating Characters with a Computer – John Lasseter
Here is the short version of what I took from these articles: The character (or robot) should have a goal, a reason to do something. Only then should it move or act to accomplish that goal. The goal or purpose behind the action is what makes it interesting, not neccesarily the action itself.
Above is a link to Pixar’s Luxo Jr. page. I just downloaded the short film on iTunes and watched it several times. Definitely inspiring. The animator never takes any liberties with the lamps construction, no squashing or bending , yet they clearly have defined personalities. I especially like the little eager “butt-wiggle” that Jr does.
Here are some more animated lamps that I found on YouTube:
- Lamp
- Luxo gets a buzz
- Grandma’s Attic
- Pixor2
- Lamps
- And some “fanimation” Vini Jr.
Robots, robots, everywhere…
Just to keep everything well linked, here are a few places to see some of my robots…
Ping-pong ball shooter
A buddy of mine (Thanks, Peter!) gave me a couple of these motor/wheel combos from HSC Electronic Supply. He said that since they were not geared, they weren’t torquey enough for a robot, but after a little brainstorming, we came up with this application…

Just a little shimming to get the right distance between the wheels so that the ball is grabbed correctly, and ZOOOM! This thing really gets a ping-pong ball moving, hard enough to hurt. For anyone else who want to try this, I am using a 5V power supply, but I am thinking 6V worth of NiCads ought to work well. The motors in parallel pull 4 amps on startup and about 1.5 amps no-load. They are quite loud as you can hear in the video, so don’t plan to sneak up on anyone.
I am thinking a tube for auto feed, a solenoid to press the ball into the wheels, a few ping pong balls, a motor controller on each side to allow for spin, and this thing could be really cool.
Latest project
As usual for me, the Hack-a-day challenge fell by the wayside. I seem to have trouble getting myself to layout a PCB. I do have this week off though, and it wouldn’t be a vacation without a little robot work. I have picked up on Flik’s (and here) little brother, Tiny. Here are a few pics:






