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

Ezang's ESP32 And ARC - Arduino And PCA 9685
ESP32 and PCA 9685 - using 3 servos for now - can add up to 16 servos on one PCA 9685 module - can connect many PCA...

Ezang's New Hand Progress, 3D Printing, Glyphs , Ultrasonic,...
I am using ARC software with 2 iotinys controller, 2 EzB4 controllers - 3 EZ-ROBOT 1300 lithium batteries for the four...

Stevenloffredo90's New To Robotics Looking For Direction
Hey everyone, my name is Steve. I am brand new to the robotics world and I have been working on a project with my...
:) 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 [email protected]
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
[email protected]
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.