Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / bootloading atmega8 on: September 02, 2013, 10:27:10 pm
hi
iam trying to bootload my atmega8 using usbasp programmer. but arduino IDE showing the error "expecting device signature 1E atmega328"
why it is asking for atmega328 when iam trying to bvootlad atmega 8?


another question is how to map the pin in bread board  assembled arduino refering  with original uno board?

is it possible to upload sketch in to my  bread board  assembled arduino  using USBASP programmer from IDE?
2  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: March 31, 2013, 11:23:03 am
for zero this will work, in that program
Code:
if ((da =0) && (db =0))
{
digitalWrite(lp,  HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, LOW);
digitalWrite(rp, HIGH);
Serial.println("go stright");
Serial.println(da);
Serial.println(db);
  
}
3  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: March 30, 2013, 10:54:08 am
most of the time it show zero in one sensor but zero may denote out of range or object very near..and i think taking mean of ping is good idea but dono how to use that method sonar.mean() and new ping is not working good in my program even serial monitor and that is not show any word tx light in uno is not glowing when i use new ping program
4  Using Arduino / Sensors / Re: NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.5 on: March 30, 2013, 08:20:13 am
hi  im building obstacle avoidance robot  using two  hs-o4  sensor and two dc motor. im using following code

Code:
#include <NewPing.h>
#define lp 9// left side motor l293
#define ln 8// left side motor l293
#define rp 7// right side motor l293
#define rn 6// right side motor l293

#define SONAR_NUM     2 // Number or sensors.
#define MAX_DISTANCE 200 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).

unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.
uint8_t currentSensor = 0;          // Keeps track of which sensor is active.
int leftsensor, rightsensor;
NewPing sonar[SONAR_NUM] = {     // Sensor object array.
  NewPing(13, 12, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
  NewPing(11, 10, MAX_DISTANCE),
 
};

void setup() {
  Serial.begin(115200);
  pingTimer[0] = millis() + 75;           // First ping starts at 75ms, gives time for the Arduino to chill before starting.
  for (uint8_t i = 1; i < SONAR_NUM; i++) // Set the starting time for each sensor.
    pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;
}

void loop() {
  for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.
    if (millis() >= pingTimer[i]) {         // Is it this sensor's time to ping?
      pingTimer[i] += PING_INTERVAL * SONAR_NUM;  // Set next time this sensor will be pinged.
      if (i == 0 && currentSensor == SONAR_NUM - 1)
      {
 leftsensor =cm[0];
rightsensor =cm[1];
if ((leftsensor >=10) && (rightsensor >=10))
{
  digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rp, HIGH);
digitalWrite(rn, LOW);
Serial.println(" go straight");
Serial.println(cm[0]);
Serial.println(cm[1]);
}

if ((leftsensor <=10) && (rightsensor >=10))
{
digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" right turn");
Serial.println(cm[0]);
Serial.println(cm[1]);
}

if ((leftsensor <=10)&& (rightsensor >=10))
{
digitalWrite(ln, HIGH);
digitalWrite(lp, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println("left turn ");
Serial.println(cm[0]);
Serial.println(cm[1]);

}
if ((leftsensor <=10) && (rightsensor <=10))
{
digitalWrite(lp,  LOW);
digitalWrite(ln, HIGH);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println("back");
Serial.println(cm[0]);
Serial.println(cm[1]);




}

if ((leftsensor =0) && (rightsensor =0))
{digitalWrite(lp,  HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, LOW);
digitalWrite(rp, HIGH);
Serial.println("go stright");
Serial.println(cm[0]);
Serial.println(cm[1]);
 
}
if ((leftsensor =0) && (rightsensor >=10))
{digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" right turn");
Serial.println(cm[0]);
Serial.println(cm[1]);
 
}
if ((leftsensor =0) && (rightsensor >=10))
{digitalWrite(ln, HIGH);
digitalWrite(lp, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" left turn");
Serial.println(cm[0]);
Serial.println(cm[1]);


      }
     
      sonar[currentSensor].timer_stop();          // Make sure previous timer is canceled before starting a new ping (insurance).
      currentSensor = i;                          // Sensor being accessed.
      cm[currentSensor] = 0;                      // Make distance zero in case there's no ping echo for this sensor.
      sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
    }
  }
  // The rest of your code would go here.

}
}

void echoCheck() { // If ping received, set the sensor distance to array.
  if (sonar[currentSensor].check_timer())
    cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
}


by using this the robot is not moving straight but it is rotating in same place slowly and if try to use serial monitor it is not printing any thing

then i tried normal code
Code:
#define ta 13// trigger
#define ea 12// eco
#define tb 11 // trigger
#define eb 10// eco
#define lp 9// left side motor l293
#define ln 8// left side motor l293
#define rp 7// right side motor l293
#define rn 6// right side motor l293

#define TIMEOUT 40000 // 40ms timeout (the HC-sr04 has 38 ms timeout)

void setup()
{
Serial.begin (19200);
pinMode(lp, OUTPUT);
pinMode(ln, OUTPUT);
pinMode(rp, OUTPUT);
pinMode(rn, OUTPUT);
pinMode(ta, OUTPUT);
pinMode(ea, INPUT);
pinMode(tb, OUTPUT);
pinMode(eb, INPUT);
digitalWrite(ta, LOW); // Ensure triger is starting with low before any pulse
delayMicroseconds(20);// Delay before first pulse
digitalWrite(tb, LOW);
delayMicroseconds(20);
}

void loop()
{
long dua, da,dub,db;

digitalWrite(ta, HIGH); // Start the a  High Pulse

delayMicroseconds(10); // Delay 10 micros

digitalWrite(ta, LOW); // End the Pulse
dua = pulseIn(ea, HIGH, TIMEOUT);
da = (dua/2) / 29.1;

digitalWrite(tb, HIGH); // Start the b High Pulse

delayMicroseconds(10); // Delay 10 micros
digitalWrite(tb, LOW); // End the Pulse
dub = pulseIn(eb, HIGH, TIMEOUT);
db = (dub/2) / 29.1;
if ((da >=10) && (db >=10))
{
 
digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rp, HIGH);
digitalWrite(rn, LOW);
Serial.println(" go straight");
Serial.println(da);
Serial.println(db);
}

if ((da <=10) && (db >=10))
{
digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" right turn");
Serial.println(da);
Serial.println(db);
}

if ((db <=10)&& (da >=10))
{
digitalWrite(ln, HIGH);
digitalWrite(lp, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println("left turn ");
Serial.println(da);
Serial.println(db);

}
if ((da <=10) && (db <=10))
{
digitalWrite(lp,  LOW);
digitalWrite(ln, HIGH);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println("back");
Serial.println(da);
Serial.println(db);




}

if ((da =0) && (db =0))
{digitalWrite(lp,  HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, LOW);
digitalWrite(rp, HIGH);
Serial.println("go stright");
Serial.println(da);
Serial.println(db);
 
}
if ((da =0) && (db >=10))
{digitalWrite(lp, HIGH);
digitalWrite(ln, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" right turn");
Serial.println(da);
Serial.println(db);
 
}
if ((db =0) && (da >=10))
{digitalWrite(ln, HIGH);
digitalWrite(lp, LOW);
digitalWrite(rn, HIGH);
digitalWrite(rp, LOW);
Serial.println(" left turn");
Serial.println(da);
Serial.println(db);
 
}
delay(50);
}
it is behaving good in serial monitor that is print turn right when blocked in left and in vice versa...
but in real robot it is rotating in clock wise not moving forward..help me to resolve it
5  Using Arduino / Sensors / Re: HC-SR04 inconsistent readings above 55CM using NewPing and Ultrasonic libraries on: March 18, 2013, 07:02:43 am
where you bought the sensor ?dx.com?
6  Using Arduino / Sensors / Re: new ping using hs-sfr 04 on: March 17, 2013, 02:22:44 am
i think  taking mean of the sensors separately  will make the code better but how to use sonar.ping_median(iterations) this for two separate sensors sonar.ping_median(iterations)
7  Using Arduino / Sensors / new ping using hs-sfr 04 on: March 16, 2013, 07:18:56 am
hai i am using  two ultrasonic sensor placed 10cm apart in a solder less board...i try to build obstacle avoidance  robot..
im using the following code for testing it befor implementing it with real robot.
Code:
#include <NewPing.h>

#define SONAR_NUM     2 // Number or sensors.
#define MAX_DISTANCE 200 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).

unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.
uint8_t currentSensor = 0;          // Keeps track of which sensor is active.
int leftsensor, rightsensor;
NewPing sonar[SONAR_NUM] = {     // Sensor object array.
  NewPing(13, 12, MAX_DISTANCE), // Each sensor's trigger pin, echo pin, and max distance to ping.
  NewPing(11, 10, MAX_DISTANCE),
 
};

void setup() {
  Serial.begin(115200);
  pingTimer[0] = millis() + 75;           // First ping starts at 75ms, gives time for the Arduino to chill before starting.
  for (uint8_t i = 1; i < SONAR_NUM; i++) // Set the starting time for each sensor.
    pingTimer[i] = pingTimer[i - 1] + PING_INTERVAL;
}

void loop() {
  for (uint8_t i = 0; i < SONAR_NUM; i++) { // Loop through all the sensors.
    if (millis() >= pingTimer[i]) {         // Is it this sensor's time to ping?
      pingTimer[i] += PING_INTERVAL * SONAR_NUM;  // Set next time this sensor will be pinged.
      if (i == 0 && currentSensor == SONAR_NUM - 1)
      {
 leftsensor =cm[0];
rightsensor =cm[1];
      }
     
      sonar[currentSensor].timer_stop();          // Make sure previous timer is canceled before starting a new ping (insurance).
      currentSensor = i;                          // Sensor being accessed.
      cm[currentSensor] = 0;                      // Make distance zero in case there's no ping echo for this sensor.
      sonar[currentSensor].ping_timer(echoCheck); // Do the ping (processing continues, interrupt will call echoCheck to look for echo).
    }
  }
  // The rest of your code would go here.
 if ((leftsensor >=10)&& (rightsensor >=10 ))
{
Serial.println(" go straight");
}


if ((leftsensor<=10)&&(rightsensor >=10))
{
Serial.println(" right turn");
}

if ((leftsensor<=10)&&(rightsensor >=10))
{
Serial.println("left turn ");
}
if ((leftsensor<=10) && (rightsensor<=10))
{
Serial.println(" back");


}
}

void echoCheck() { // If ping received, set the sensor distance to array.
  if (sonar[currentSensor].check_timer())
    cm[currentSensor] = sonar[currentSensor].ping_result / US_ROUNDTRIP_CM;
}
when  i run this code in serial monitor .... i left both the sensors uninterrupted  instead of printing "go straight" it is printing "back"...
i dont no why this happens and i think it is may be due to echo..or coz of bad reading
 im planning to take median of the each sensor separately but how to do it..i know sonar.ping_median(iterations) method and have no idea about how to use it..where to write this method..

8  Using Arduino / Programming Questions / Re: my first arduino robot on: March 12, 2013, 10:17:33 pm
ya i edited it thank u
9  Using Arduino / Programming Questions / Re: avrdude: stk500_getsync(): not in sync: resp=0x00 on: March 12, 2013, 09:48:24 pm
problem fixed. it is due to driver only i reinstalled it smiley-lol
10  Using Arduino / Programming Questions / my first arduino robot on: March 12, 2013, 12:33:05 pm
 i have a chasis, 2  hc sr 04 sensor and uno rev3 so i thought to start coding

i edited this code for obstacle avoidance
Code:
#define trigPin 13

#define echoPin 12

#define TIMEOUT 40000 // 40ms timeout (the HC-sr04 has 38 ms timeout)

 

void setup()

{

Serial.begin (19200);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

digitalWrite(trigPin, LOW); // Ensure triger is starting with low befre any pulse

delayMicroseconds(20); // Delay before first pulse

}

 

void loop()

{

long duration, distance;

 

digitalWrite(trigPin, HIGH); // Start the High Pulse

 

delayMicroseconds(10); // Delay 10 micros

 

digitalWrite(trigPin, LOW); // End the Pulse

duration = pulseIn(echoPin, HIGH, TIMEOUT);

distance = (duration/2) / 29.1;

 

if (distance >= 400 || distance <= 0)

{

Serial.println("Out of range");

}

else

{

Serial.print(distance);

Serial.println(" cm");

}

delay(50);

} "

into this

//my code
Code:
#define ta 13   //trig pin of A ultrasonic sensor

#define ea 12   //eco pin of A ultrasonic sensor

#define tb 11    //trig pin of Bultrasonic sensor

#define eb 10   //trig pin of B ultrasonic sensor

#define lp 9  // pin to l293 to control left motor

#define ln 8  //pin to l293 to control left motor

#define rp 7  //pin to l293 to control rightmotor

#define rn 6  //pin to l293 to control right motor

 

#define TIMEOUT 40000     // 40ms timeout (the HC-sr04 has 38 ms timeout)

 

void setup()

{

Serial.begin (19200);

pinMode(lp, OUTPUT);

pinMode(ln, OUTPUT);

pinMode(rp, OUTPUT);

pinMode(rn, OUTPUT);

pinMode(ta, OUTPUT);

pinMode(ea, INPUT);

pinMode(tb, OUTPUT);

pinMode(eb, INPUT);

digitalWrite(ta, LOW);    // Ensure triger is starting with low before any pulse

delayMicroseconds(20);  // Delay before first pulse

digitalWrite(tb, LOW);

delayMicroseconds(20);

}

 

void loop()

{

long dua, da,dub,db;    // dua duration of A sensor// da distance by A sensor// in the same way dub//db

 

digitalWrite(ta, HIGH); // Start the a  High Pulse

 

delayMicroseconds(10); // Delay 10 micros

 

digitalWrite(ta, LOW);    // End the Pulse

dua = pulseIn(ea, HIGH, TIMEOUT);

da = (dua/2) / 29.1;

 

digitalWrite(tb, HIGH); // Start the b High Pulse

 

delayMicroseconds(10); // Delay 10 micros

digitalWrite(tb, LOW); // End the Pulse

dub = pulseIn(eb, HIGH, TIMEOUT);

db = (dub/2) / 29.1;

if ((da >=10) && (db >=10))

{

digitalWrite(lp, HIGH);

digitalWrite(ln, LOW);  \\ turning right concidering obstacle in left sensor A with in 10 cm

digitalWrite(rp, HIGH);

digitalWrite(rn, LOW);

}

 

if ((da <=10) && (db >=10))

{

digitalWrite(lp, HIGH);

digitalWrite(ln, LOW);

digitalWrite(rn, HIGH); //turning left concidering obstacle in left sensor A with in 10 cm

digitalWrite(rp, LOW);

}

 

if ((db <=10)&& (da >=10))

{

digitalWrite(ln, HIGH);

digitalWrite(lp, LOW);

digitalWrite(rn, HIGH);

digitalWrite(rp, LOW);

}

if ((da <=10) && (db <=10))

{

digitalWrite(lp, HIGH);

digitalWrite(ln, LOW); // turning right concidering obstacle in both A and B sensor  with in 10 cm

digitalWrite(rn, HIGH);

digitalWrite(rp, LOW);

delay(7000); // giving some delay thinking that robot will turn enough from the obstacle

digitalWrite(lp, HIGH);

digitalWrite(ln, LOW);// ten left turn to robot to travel stright always

digitalWrite(rp, HIGH);

digitalWrite(rn, LOW);

 

 

}

 

delay(50);

}

instead of testing this with real robot i planned for a pre check using serial monitor to print direction of robot travelling(replaced the motor block by print statment)

code below
Code:
#define ta 13   //trig pin of A ultrasonic sensor

#define ea 12   //eco pin of A ultrasonic sensor

#define tb 11    //trig pin of Bultrasonic sensor

#define eb 10   //trig pin of B ultrasonic sensor/trig pin of A ultrasonic sensor

.#define TIMEOUT 40000 // 40ms timeout (the HC-sr04 has 38 ms timeout)

 

void setup()

{

Serial.begin (19200);

 

pinMode(ta, OUTPUT);

pinMode(ea, INPUT);

pinMode(tb, OUTPUT);

pinMode(eb, INPUT);

digitalWrite(ta, LOW); // Ensure triger is starting with low before any pulse

delayMicroseconds(20);// Delay before first pulse

digitalWrite(tb, LOW);

delayMicroseconds(20);

}

 

void loop()

{

long dua, da, dub, db;  // dua duration of A sensor// da distance by A sensor// in the same way dub//db

 

digitalWrite(ta, HIGH); // Start the a  High Pulse

 

delayMicroseconds(10); // Delay 10 micros

 

digitalWrite(ta, LOW); // End the Pulse

dua = pulseIn(ea, HIGH, TIMEOUT);

da = (dua/2) / 29.1;

 

digitalWrite(tb, HIGH); // Start the b High Pulse

 

delayMicroseconds(10); // Delay 10 micros

digitalWrite(tb, LOW); // End the Pulse

dub = pulseIn(eb, HIGH, TIMEOUT);

db = (dub/2) / 29.1;

 

if ((da >=10)&& (db >=10 ))

{

Serial.println(" go straight");

}

 

 

if ((da <=10)&&(db >=10))

{

Serial.println(" right turn");

}

 

if ((db <=10)&&(da >=10))

{

Serial.println("left turn ");

}

if ((da <=10) && (db <=10))

{

Serial.println(" right turn");

delay(50000);

Serial.println(" left turn ");

 

 

}

 

delay(50);

}

then  i tested the above code with only two sensor...... i left both sensor unintreuptted so o/p should be printing only "go stright" statment but the output is mixed with "right turn" and "left turn" statment i dont no why...

help me to fix this and i like to go for pwm speed control(for that i have only l293 not arduino motor sheild ) so direct me, having lots of idea about add on like bluethoot contol using android app and add navigation capability

 
11  Topics / Robotics / Re: Arduino in the data center on: March 09, 2013, 12:18:05 pm
r u from tamil nadu?
im hope so.
12  Using Arduino / Programming Questions / avrdude: stk500_getsync(): not in sync: resp=0x00 on: March 09, 2013, 11:19:13 am
im getting this error when uploading my sketch in to my new uno

"Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)

avrdude: stk500_getsync(): not in sync: resp=0x00 "

im having arduino uno rev3 bought from the dx. using windows xp sp3, arduino 1.o.3 ide, arduino is connected in COM28....... is this problem with board?
 arduino is not found in device manager.
13  Using Arduino / Installation & Troubleshooting / Re: avrdude: stk500_getsync(): not in sync: resp=0x00 on: March 09, 2013, 11:07:23 am
same problem
"Binary sketch size: 1,084 bytes (of a 32,256 byte maximum)

avrdude: stk500_getsync(): not in sync: resp=0x00 "

im having arduino uno bought from the dx. using windows xp, arduino 1.o.3 ide, arduino is connected in COM28.....
14  Using Arduino / Installation & Troubleshooting / installation fail on: March 07, 2013, 12:11:47 pm
iam using 32 bit windows 7 os ...im trying to install arduino1.0.1 ide, when ever i double clik .exe file arduino splash screen appears and disappears with out any  further action???
Pages: [1]