Let's Make Robots!

attiny85 h-bridge ldr robot

I have an idea for making an simple robot. Maybe solar powered... doesnt have to be...

I have an ATTiny85, an h-bridge from an arduino motorshield (L293D, I think) and some LDR sensors and some 3V-6V motors.

My question is, can I somehow put them all together to make a simple robot? If so, do I need anything else, besides simple resistors and capacitors? Or am I missing something?

Update 3-25-2012: So I used this simple code to program the ATtiny using the Arduino as ISP

 

void setup() {                

  // initialize the digital pin as an output.

  // Pin 13 has an LED connected on most Arduino boards:

  pinMode(0, OUTPUT);

  pinMode(1, OUTPUT);  

}

 

void loop() {

   digitalWrite(0, HIGH);   // set the LED on

  delay(1000);              // wait for a second

  digitalWrite(0, LOW);    // set the LED off

  delay(1000);              // wait for a second

  digitalWrite(1, HIGH);   // set the LED on

  delay(1000);              // wait for a second

  digitalWrite(1, LOW);   // set the LED on

  delay(1000);              // wait for a second

}

 

Here is a picture of my circuit

solar ATtiny85

 

Check out the video! I got the motor to turn both directions. Forward and reverse!

 

Update 2 - 3-25-2012 : I added a LDR sensor to the circuit and updated the code to turn the motor forward if the analog reads less than 500 and opposite if it read more than 500.

int photocellPin = 2;     // the cell and 10K pulldown are connected to a0
int photocellReading;     // the analog reading from the sensor divider

void setup() {                

  pinMode(0, OUTPUT);

  pinMode(1, OUTPUT);  

  digitalWrite(0, LOW);

  digitalWrite(1, LOW);

}

void loop() {

  photocellReading = analogRead(photocellPin);   

 if (photocellReading < 500){

     digitalWrite(0, HIGH);    

     digitalWrite(1, LOW);  

 } 

   if (photocellReading > 500) {

     digitalWrite(0, LOW);    

     digitalWrite(1, HIGH);   

   }

  delay(150);       

} 

 

Comment viewing options

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

what surprises me is that no one has done something like this before. Or maybe I didnt look hard enough. I havent seen anyone use a ATtiny85 as a brain for a bug/bot. I wonder why?... but I am sure people can prove me wrong.

There are some here using ATTiny but you really have to search for. I also got a hard time to find smething what helped me to get  a start with those little bugs ;-)