Multiple Sensors On One Uart

Luis Vazquez

USA
robot video thumbnail

Ok this is going to be awesome!

So here is my Idea:

1 Sure DC SS503V100 Dual Axis Compass . used for robot orientation and also I will snap shot the angle the ping was pointed when it was shot.

User-inserted image

4 Ultrasonic Ping Sensors HC SR04

User-inserted image

1 one Arduino Pro Mini

User-inserted image

Connect all 5 Sensors to the Arduino then connect the Arduino to the EZB4.

User-inserted image

I have done some testing all this will work nice. I'm going to be working on putting them into a single package.

I'll get it all wired up and working and will update this thread in a few days.

By — Last update

ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

#18  

Ok here is the video on step too...

Thanks for the Software update @DJ Sures

User-inserted image

User-inserted image

User-inserted image

Hope you guys find this kinda stuff useful.

#19  

YES!

keep going...lol

just roli along... little humor. lol

j:D

#20  

I have been asked for the Arduino Sketch Source.

Here ya go ...



int DS1 = 9;
int DS2 = 8;
int DS3 = 7;
int DS4 = 6;
long duration, inches, cm;
int Trigger = 10;


String Output = "";
// ib = incoming byte

int IsScaning =0 ;


void setup() {

  Serial.begin(9600);
}

void loop()
{

  

  
  
if (Serial.available())
{

  if (IsScaning == 0)
  {
 
   IsScaning = 1; 
   Output = "";
  int ib = 0  ;
  ib = Serial.read();
  
  
 
  
  if (ib == 100){Output = "";readDistanceAll();IsScaning=0;}
  
  if (ib == 101){
 //   String Output = "D1=";
    Output += readDistance(DS1);
    Serial.println(Output);
     IsScaning = 0; 
   }
  
  if (ib == 102){
 //   String Output = "D2=";
    Output += readDistance(DS2);
    Serial.println(Output);
     IsScaning = 0; 
    }
    
    
  if (ib == 103){
  //    String Output = "D3=";
      Output += readDistance(DS3);
      Serial.println(Output);
       IsScaning = 0; 
      }
      
      
  if (ib == 104){
  
 // String Output = "D4=";
  
  Output += readDistance(DS4);
  Serial.println(Output);
   IsScaning = 0; 
  }
  
  }

}  
  
  

 delay(200);
}

void TriggerAllPorts()
{
  pinMode(Trigger, OUTPUT);
  digitalWrite(Trigger, LOW);
  delayMicroseconds(2);
  digitalWrite(Trigger, HIGH);
  delayMicroseconds(5);
  digitalWrite(Trigger, LOW);
}


String readDistanceAll()
{


  
 // Output += "D1=";
  
  Output += readDistance(DS1);
  Output += ":";
  Output += readDistance(DS2);
  Output += ":";
  Output += readDistance(DS3);
  Output += ":";
  Output += readDistance(DS4);
  
  Serial.println(Output);
   IsScaning = 0; 
}

int readDistance(int SensorPin)
{

  TriggerAllPorts();

  pinMode (SensorPin, INPUT);
  duration = pulseIn(SensorPin, HIGH);
  cm = microsecondsToCentimeters(duration);
  delay(100);
  return cm;
}


long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}



Let me know if you need any more information.

PRO
Synthiam
#21  

really awesome idea! I totally dig it:D

I'm also glad the latest release is working for you

#22  

Thanks @DJ Sures , I really was not having issues because I authored the software in the Arduino so I could just stay with in the 0-127 range unlike @mtiberia who is talking to devices he has not control over the firmware.

Soon as I get the servo for JD head I will be posting many videos of him interacting with my little girl Sativa. I have been working out code that will read along with her in her story books , reminding her to change pages and using vision to insure the correct book and page.

I have been able to get some simple ocr so JD should be able to read the text from the book.

PRO
Synthiam
#23  

What a neat idea by having the robot interact with the child. JD can be her jiminy cricket like the teddy bear from AI

you can have the robot also helping her with life lessons - maybe when she has a bad dream/nightmare you can run a program for her that talks her to sleep or tells a story of why there is no boogy man:D

#24  

Right now we are helping her speech by making sure that the words she is having trouble saying are part of the command set she will use with the robot. That way the robot only responds when she pronounces the words correctly , I think in the short time we have tested this , her words have gotten better.