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

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

#1  

Firstly, the ultrasonic sensors don't use UART on the ez-b. They can be plugged direct into the ez-b digital ports. That compass sensor could be scripted into ARC too.

I don't see the need for the arduino at all. Connecting an arduino has been done before.

Tech

United Kingdom
#2  

Techno, I don't think you are following the post/idea.

All of the sensors above will connect to one UART port, freeing up 8 digital ports for the HC SR04 alone.

The EZ-B will connect to the Arduino via serial. The EZ-B will send a command which will trigger reading of the sensor(s). The 5 sensors will connect to the Arduino. The Arduino will read the sensors. The Arduino will return the result back to the EZ-B via serial. ARC stores it as a variable. ARC can use that variable for whatever.

It sounds like a great idea to me. It will free up a lot of ports on the EZ-B.

However, where has the Arduino been connected to the EZ-B like this before? I must have missed that topic.

#3  

First you still need some type of voltage regulator for many of the sensors. The arduino board can take in 6 to 12 volts and puts out a regulated 5 vots.

Each Sensor uses a ping on the EZB. so your talking about using a min of 2 ports per Ultrasonic sensor and the addition of the Dual compass what would use a uart port. (as i have had little luck using it on I2C)

so all in all I will have a little device that is about 4 in x 4 in x 1 inch that does all that and only uses one UART Port on the ezb.

#10  

@Rich Since i am moving this to the UART port.

I will have command that will allow for pinging for each or all sensors.

Also i have not totally wired up all 4 . I think i can use a single pin for ping. and have the echo pins separated.

have you or anyone else trying to trigger multiple sensors on a single digital pin for Trigger?

United Kingdom
#11  

I haven't tried that and I haven't noticed anyone else say they have (but I may have missed it).

In theory I can't see why it wouldn't work since it's the echo which is needed as far as I am aware (I'm no expert in how they work mind you). In theory it would trigger all at the same time, the only issue I can see may be that the time delay between receiving on the echos may make the readings inaccurate on sensors 2 to 4. It may also cause interference on sensors depending on what they are aimed at (ghost signals or something like that I think they call it).

Does the Arduino have enough pins for 4 triggers and 4 echos? If it does I would do it that way personally but only because I don't understand enough about the sensor to know one combined trigger wouldn't cause any problems.

#12  

I don't think anyone has tried using a single trigger into multiple sensors mainly due to the fact that the resultant info returned back would need to be fed into different ports.

United Kingdom
#13  

A simple test would be to try it on the EZ-B or Arduino. Wire up for 2 sensors, put both triggers on one port, echo 1 on another port and echo 2 on another port. Try reading one then the other then both. See if the both result is the same as the first two.

#14  

You won't be able to get the correct values from the arduino until the issues with the UART is fixed. I've tried .

#15  

I did some testing and yes I can use the same trigger pin for all Sensors. Woohoo my responses are all in the rang of 1 - 127.

Right now I am taking the project off the bread board and doing some soldering , wrapping and the such to make it more permanent.

Some one was asking why would you want to do this and even though good answers have been given .. here is why i need it.

User-inserted image

I am building this car for JD. when he sits in it. all i have to do is plug the car into the 4 pin UART.

Now the car is part of JD. So when he is in the car and moves forward , he will not walk but soon as you unplug the car the know he should go forward.

now that he is hooked to the car he can use all servos and sensors on the car via commands to the arduino board via UART!

Just think .. you can make tool and accessories for him .. and all you have to do is plug it in..

make a script that will poll that uart port and when it finds something it knows how to use.. then bingo!

Im going to make him a ray gun too!

#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.