Hello all,
I wail back I posted some information on using an Arduino as a I2C Sensor controller to use with the EZB3&4
I will post this in 3 stages ..
Stage one.. right here right now.
In this video you can see how im using the arduino to read the ultrasonic sensor . that in turn is being read by the EZB board via I2C.
This is the only code needed to read the ping for the EzBuilder script
print(I2CRead(0, 2,6 ))
The code for the Arduino is
#include
void setup()
{
Wire.begin(2);
Wire.onRequest(requestEvent);
}
void loop()
{
delay(100);
}
void requestEvent()
{
long duration, inches, cm;
pinMode(9, OUTPUT);// attach pin 3 to Trig
digitalWrite(9, LOW);
delayMicroseconds(2);
digitalWrite(9, HIGH);
delayMicroseconds(5);
digitalWrite(9, LOW);
pinMode (8, INPUT);//attach pin 4 to Echo
duration = pulseIn(8, HIGH);
// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
String outtoezb;
outtoezb += "D1=";
outtoezb += inches;
outtoezb += ":";
char tempout[outtoezb.length() + 1];
outtoezb.toCharArray(tempout,outtoezb.length() + 1);
Wire.write(tempout);
}
long microsecondsToInches(long microseconds)
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds)
{
return microseconds / 29 / 2;
}
Phase two will be adding the 3 other ping sensors and a temp sensor to the arduino . I hope to have it all encased together will plugs and off the project board.
I will follow up on this thread as the next phase is done I will provide the code for EzBuilder as well as the arduino code.
Hope yall can use it.
By Luis Vazquez
— Last update
Other robots from Synthiam community
DJ's Jd's Friday The 13Th
Beware of the robots on Friday the 13th! Thanks for the face mask Justin
Robot56's Just Another Omnibot
This is my Omnibot Tomy. I havent really been able to work on him much, but Ive been collecting a lot of parts. I have...
Bhouston's My Inmoov Running On Synthiam
Initial test of my InMoov robot running on the new EZBv4. I have 24 servos connected to one v4 and all are running OK....
Hi Luis, great tutorials on the Arduino I'm working to hook up an Ultrasonic to an Arduino Mega, and not sure about the pinout. Just looking for some quick input This is confusing me a little bit so thought i should ask.
pinMode(9, OUTPUT);// attach pin 3 to Trig
Of course the pinout will differ with the mega, but i see you referring to Pin 3 to Trig,
But init, Pin 9. The D1 in reference to the EZB. Where does Pin 3 come into play?
Sensor HC-SR04
Not to belittle what is being done here, why not just connect the ultrasonic sensors directly to the EZB ? What is the advantage of connecting them to an Arduino board?
I have to agree with @Bob.... @dwrightny2266 Once you really start getting into the ezb4 and ARC, I'm afraid your arduino days will be numbered... Yes, the ezb is that amazing... Eventually like mine, sooner than later your arduinos will end up in the back of your hobby drawer collecting dust too...
Hey guys, thanks for the input, and In terms of running the robot/rover itself, it will definitely be handled by the EZB4 boards, wouldn't have it another way The overall project is pretty ambitious, and started out all Arduino, but not now Thanks to this product and community, we have switched gears . With that said, A big portion of the project involves Arduino as well as other platforms for educational purposes, mainly programming. Again, the Main operating system including autonomous navigation, will be all EZB. The rest will be external systems, accessed independently, to control various parts of the rover.
@dwrightny2266 Ok sounds awesome... So the Arduinos are too "entrenched" into this project... Got ya' ... Keeps us updated on the project...
Cheers
The Rover will be eventually in Utah, and will act as an educational platform for various types of programming, such as C++. It will be accessed, with a lesson plan, to program, trouble shoot, etc... part of the rover, Robotic arm for example, by a student. When it comes to teaching long distance remote navigation skills, that will be a different system entirely, involving the EZB Very exciting! The first concept rover is set for testing in 4 moths.
Maybe you can up load some picks when you have a chance. I (we) would love to see your project... Again, sounds awesome....
@Richard R,
The other use for this concept is similar to why a Sabertooth is better than most other H-bridges. Using a single UART port on the EZ-B you an greatly expand the number of sensors available, and they can run largely independently and only tell EZ-B when there is a problem to react to, taking away some of the processing load (only an issue with low power computers, but could effect some embedded systems)
Alan
The concept rover is a Jazzy Wheel Chair base, and the Sabertooth dual 60A motor driver, is on this weeks shopping list Were up in the air on the final design, now after playing with the option of incorporating a Fifth wheel design, with the trailer style unit to house the educational platforms., including solar power, but this is a year out. Ive also contemplated incorporating an Arduino on the main system for back up in case of loss of signal, or PC failure, so the rig doesn't go dark/dumb on me.
Actually... that's a good use for the arduino... If the ezb should lose connection an arduino can be programed for an "elegant safe" shutdown sequence... Nice
@Luis Vazquez Hi Luis, im working with your Arduino code, and running into a few problems. Obviously you have had this running, so not sure where the errors are coming from. Im using V 1.0.6 any chance it may have to do with version?
Hello Dana, I have been off the forums for a bit. Someone told me you were having some issue.. I will be happy to help any way i can. It looks here like you are missing the Wire Library.
It should be included in your arduino editor. Here is a like to the library information. though I'm not sure right off where to download it other than it comes with the Arduino Editor.
Wire Reference from Arduino
If you need more help please let me know.
I love the EZB and it solved lots of problems face the by the robot builder but truth this it is not gods give to robotics and I encourage anyone to experiment with other controllers as in combination they can come up with something actual ground breaking. I have stop participation on this forum because of that reason. I am working with other forums that are interested in building robots , no mater how you have to do it. seem this is a use ezb or get out kinda forum.
Luis,
Sorry to see you aren't participating here anymore. Obviously, as a company owned forum, the primary focus will be their product, but I think what you have done in combining the capabilities of EZ-B with other controllers to extend the functionality is brilliant, and I for one will miss your participation.
Could you let us know where you are participating? I am always interested in broadening my horizons.
Alan
OK, thank you very much Luis! Thanks for stopping by Much appreciated. Would love to know of other good forums, since the nature of the project I'm working uses multiple platforms. I think your right on the Library, I'm going to reinstall the IDE to see if it helps, since i would expect it to be there as well, thanks again
"If your not having fun, your not doing it right!"
Hey Luis
I second what Alan said. I miss your input and the projects you shared with us. To me (my opinion) the idea of using the Arduino or any other microcontroller with the EZB is a great idea. Would like to continue seeing your work and hearing of any new ideas you have.
If you read this, Please send me a email so I can keep in touch with you!
Old-FireFighter138(at)neo(dot)rr(dot)com
Thanks
:) Happy day! Got it Luis! I included #include <Wire.h> and Bingo, all set
In my opinion, including the Arduino, or users using other platforms in this community, is an absolute necessity! Arduino, will NEVER! Be a EZB type product, so not even playing the same game in terms of competition.
Luis please send other forum info my way also at kamaroman68@aol.com
Wow, this sucks Luis. Sorry you feel that you were not appreciated or welcome. True or not, I can see how you may have thought that. People get passionate about what they believe in. I'll miss you and am sorry to see you leave. I was leaning a lot from what you were doing and the videos you offered us. Happy trails!
I think allot of the problems here can be solved with proper forums. The forum software used here is not easy to follow and leaves information and topics scattered and hard to follow. I will continue to pop in and will be creating more videos. I have two large robotic project I'm working on so if the engine involved allows it, I will document what we are doing. The EZB-4 board will be in use and we will need the expertise in this forum so move though the project but there will also be many Arduino boards used in the solutions.
We are working on autonomous behavior in the instance that the EZB-4is powered down or has long connection to the software( software crash would be the most likely problem) .
Along with shutdown over rides on motor controllers what will not require the EZB-4 be powered up to function.
Another bot is balanced on 2 wheels. and the communication time from the EZB-4 to the PC and back to the EZB-4 then to the motor controllers is not realistic and does not work.
so I am using an Arduino board to balance the bot with serial communication commands from the EZB-4 to move forward , back , etc.
I will be popping in now things are slowing down some.
Sorry to see you go, but will look for you post as you progress! Enjoyed you tutorials Shoot me your email, if you wouldn't mind
dwrightny2266@yahoo.com
Luis, I have learned much from your posts. Please stay in touch, I think all of us are OPEN to learn more. EZ Robot is the best I have found since getting back into robotics. Best wishes, Steve S
Hi Luis.
Thank you so much for this great tutorial! Is there any way I can send commands from the ARC / Script to an Arduino by using the I2C interface?
I already tried lots of things, including this EZ-B script:
With this Arduino code I wrote:
But I don't get any characters on the Arduino and EZ-B script engine does not show any error.
Any help would be highly appreciated!
Thank you!
You have to put the arduino in SLAVE i2c mode, not master. Slave mode uses events when data is transmitted. i2c does not work liek Serial, with an input buffer, etc... It's a totally different protocol.
Any updates for using more then 1 ping sensor?
This is a very old deprecated thread. You can use as many ping sensors as the hardware supports. The ARC software supports arduino connections directly. Check the getting started guide (link on top of this website) for information.