Distance sensor with I2C

Alles rund um TX(T) und RoboPro, mit ft-Hard- und Software
Computing using original ft hard- and software
Forumsregeln
Bitte beachte die Forumsregeln!
Antworten
Drugovi
Beiträge: 5
Registriert: 10 Jul 2013, 21:46

Distance sensor with I2C

Beitrag von Drugovi » 10 Jul 2013, 22:14

Does anybody know of a distance sensor that is cheap (for us in Croatia everything is expensive), compatible with I2C and if there is a driver for it ? I really would like to equip my Rescue robot with some more distance sensors but I don't have any inputs left and the Fischertechnik ones are quite expensive. I found some distance sensors that are cheap and I2C compatible but Im only 14 and dont know how to make them work if possible (I'm still new to I2C).If anybody could tell me if such a sensor exists with the required software or teach me how to make the software I would be really thankful. :)

p.s. I understand German but it's easier to write in English for me.

Benutzeravatar
Dirk Fox
ft:pedia-Herausgeber
Beiträge: 1833
Registriert: 01 Nov 2010, 00:49
Wohnort: Karlsruhe
Kontaktdaten:

Re: Distance sensor with I2C

Beitrag von Dirk Fox » 10 Jul 2013, 22:44

Hello Drugovi,

some month ago I bought a Devantech SRF08 ultra sonic sensor (it's not the cheapest, I confess...) and implemented the necessary I²C driver in RoboPro. It is working perfectly well...

As far as I know, the cheapest ultra sonic sensor with I²C interface available from the Devantech family, is the SRF02 (about 14 Euro plus shipping, see e.g. http://de.manu-systems.com/SRF02.shtml), ranging from 16 cm to 6 m. Writing the driver should not be very challenging.

Regards,
Dirk

Drugovi
Beiträge: 5
Registriert: 10 Jul 2013, 21:46

Re: Distance sensor with I2C

Beitrag von Drugovi » 15 Aug 2013, 18:50

Hello!

My goal was to upgrade my rescue robot by putting more ultrasonic sensors on it that will communicate with robo TX controller by i2c.

I bought some HC-SR04 ultrasonic sensors. As robo TX controller couldn´t detect signal from this distance sensors (HC-SR04 sensor sends a signal on its eccho pin when requested by its trigger pin, only problem was that it sends a signal that is only a few microseconds long, and fischertechnik TX is too "slow" to detect that short signal).

So I decided to buy an arduino which is compatible with HC-SR04 sensors, my idea was that arduino would process data from several HC-SR04 sensors and send their values to robo TX controller by i2c on its ext2 port.

I managed to read distance from sensors on arduino, also managed to send data from TX to arduino, but I dont know how to send data (sensor distance) from arduino to TX controller via i2c.
I found a page on Rei Vilo´s fischertechnik corner, but I don´t understand the program, and a part of it is "missing".

link to the page --> http://reivilofischertechnik.weebly.com ... rface.html

So shortly I need someone to either explain me the program on Rei Vilo´s page, or if someone would be so kind and post/send me an arduino program that sends data from arduino to robo TX controller (when requested(if necessary)).

I would be very grateful if someone would help me with my problem.

Thanks :) ,

Drugovi

Ad2
Beiträge: 306
Registriert: 31 Okt 2010, 22:20

Re: Distance sensor with I2C

Beitrag von Ad2 » 15 Aug 2013, 20:30

Indeed, the TX is I2C master and need to request the data from the Arduino. Therefore the Arduino need to be configured as an I2C slave.

Drugovi
Beiträge: 5
Registriert: 10 Jul 2013, 21:46

Re: Distance sensor with I2C

Beitrag von Drugovi » 15 Aug 2013, 21:01

Thanks for your reply!

I managed to send data from the Tx to the arduino but I dont know how to send data from the arduio to TX. Could you help me with the code on the Arduino side ?

Kind regards.

Klub_Robotik_G-COM
Beiträge: 14
Registriert: 19 Jul 2012, 12:15

Re: Distance sensor with I2C

Beitrag von Klub_Robotik_G-COM » 17 Aug 2013, 05:50

Drugovi hat geschrieben:Could you help me with the code on the Arduino side ?
hello Drugovi, we are trying a similar connection but haven't been able to succeed with a servo function.

have a look at this thread and maybe you could expand further for your requirements.
http://forum.ftcommunity.de/viewtopic.php?t=1448

Drugovi
Beiträge: 5
Registriert: 10 Jul 2013, 21:46

Re: Distance sensor with I2C

Beitrag von Drugovi » 17 Aug 2013, 21:26

Klub_Robotik_G-COM hat geschrieben:hello Drugovi, we are trying a similar connection but haven't been able to succeed with a servo function.

have a look at this thread and maybe you could expand further for your requirements.
http://forum.ftcommunity.de/viewtopic.php?t=1448
Thank you for your help.

My friend has made a working program code with the example files from the arduino website. He doesn't really know how its working but its working. We tested it by requesting sensor distance from the arduino by sending data byte "0x1" to the address "0x14". When the arduino gets this data ("0x1") he sends the distance of a specific sensor, via I2C port to the TX ,which he before that calculated.

Antworten