Let's Make Robots!

"Hedwig"-USB Powered Owl Head

HedvigPdes.zip2.18 KB

This one I made for my future sister-in-law for Christmas. (She's a big Harry Potter fan.) It uses two CdS cells, Two AT Tiny 45s, two blue high-output LEDs and a single servo. The body is made from extruded PVC (Sintra/Komatex/etc.) and a PVC pipe joiner. I used an Arduino as ISP to program the AVRs. This project served as a demonstration of how sometimes it's actually easier to use microprocessors to achieve results normally associated with BEAM robotics. If you think about it, the component count is about half what you'd have for a bicore head and the number of solder joints is less than half, with the added benefit of not having to hack the servo. Also, trying to get a Schmidt Trigger cascade to function is such a crapshoot-you can go through a roll of chips and maybe have one work. Also, trying to get a 555 or a 741 to "breath" is more challenging than the available schema would predict.

Update-Pi day, 2013

I'm not just doing this for attention, I swear.  There are a few other LMR members now interested in the ATTinies, so as a resource I thought I'd add some more goodies.  For starters, here's the schematic:

The servo is just a regular old cheap eBay transluscent blue 9g (not even an official "Tower Pro."

I've also added the sketches.  Remember this is Arduino as ISP with the HLT cores.  The ATTinies are as far as I'm concerned not a great choice for servo control or small robots.  If you want to work with an 8pin DIP micro, in my experience the PICAxes 08m(2)s are a better choice.  The Tinies have their place, but they just don't have good enough timing (at least not through Arduino as ISP-I've never tried another AVR programmer or a crystal regulated ATTiny for example.)  The servo control I acheived on Hedvig by all rights shouldn't work, and possibly was a fluke of combination of one individual chip and one individual servo just happening to be on the same "wavelength" as it were.  I just found one PWM frequency that forced it all the way right, one all the way left and one that (unbelievably) centered it up.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


Sweet - I really like quirky little gadgets like this.

What's the logic?  Does it monitor the 2 ADCs and move towards the one which shows the greatest movement away from a short-term average band? (I don't have the Arduino IDE so can't see the code.)

Here's the main loop: 

void loop() 
 int rightEyeValue = analogRead(1);            // reads the value of the photocells, between roughly 150 and 850
 int leftEyeValue = analogRead(2);            // reads the value of the photocells, between roughly 150 and 850
  if ((rightEyeValue-50)>leftEyeValue)
    analogWrite(0,35); //about 45 degrees off center to left/pin 3
  else if ((leftEyeValue-50)>rightEyeValue)
    analogWrite (0, 15);//about 45 degrees off center to right/pin 7
    analogWrite (0, 25);//roughly the middle
  }   } 

Neat way of doing it - Thanks.

I tell you, I see eye lids when that thing blinks. I know they're not there, but my brain keeps trying to tell me they are.

Very cool project.

I realize this is actually an old post but I thought I would share. The ATTinies use an 8 bit timer which makes controlling servos difficult, This library is supposed to take care of those difficulties. It supports up to 5 servos running on the internal 8mhz clock.

Not to be condescending, but I take it you haven't actually tried that library ;-). Rob-Bot-X and I have both put the Cunning Turtle servo8bit.h through the paces and neither of us got so much as a twitch out of a servo. I did some experiments with the technique I used on Pip5queak too and while the servo did at times reach the almost predicted position, other timing functions were thrown off for some reason (that's both with delay and millisecond methods.)

Maybe your chip didn't have the fuse set to 8 Mhz? They are set to 1Mhz from the factory.

Sorry for the tears :P After a battle like that, I could imagine someone making such a suggestion later on.

You almost have to laugh. :)

I think you need to have an AVR programmer rather than using Arduino as IsP to change the fuse settings, and the cunning turtle library is for use with Arduino as IsP. I will say this-even with the new 8 MHz cores available in the HLT offerings, Running on the latest version of Arduino (1.3pointsomething which has the best ATTiny ISP implementation yet) the servo8bit.h library never worked for me (or Gabriel.)

Have you actually gotten servo8bit.h to work on a Tiny 25/45/85 with Arduino as Isp, JerZ? I wonder if it has to do with the system I'm on. I have 'duino on the PC but I've never written a sketch over there-only Picaxe, Beagle and Stellaris so far. I've kept all the Atmel stuff on the PowerPC just because...

Just a pair of voltage dividers across two input pins on one At tiny and an output pin pwming the servo, with a second AtTiny for the eyes.

interesting  work .can i know the technic behind it.