Forum

Sfr05 ultrasonic sensor with arduino

Hello everyone,
I’m doing tests for an installation; I want to use sfr05 ultrasonic sensor for an interaction part using arduino vvvv node firmata

http://www.robot-electronics.co.uk/htm/srf05tech.htm

I’m having problem with it. Working direclty on arduino processing program with the file located in example_sensor_ping, connect on the digital pin it works; with the arduino module i was working with analog firmata, simple analog, digital, all inputs (I tried all firmata drivers)without a positive response.
How can I set up the arduino board connections pins for the sensor? (analog?digital?) WIch firmata driver should I load on the arduino board to obtain distance values?
Thank you in advance

Tommy

UWG it wort work with firmata
the ping senson, uses only 1 pin, it use it as an output to send the pulse, then it starts a timer, it switch the same pin as an imput and it measure the time to get a response, after that some math and you get the distance

with firmata you wont be able to do it so quick…
i would recomend to use the same sketch on the arduino examples
and from vvvv just use the node rs232 to read the values that the sketch its sending to the serial port
thats much easier

Hi vjc4,

first of all thank you so much for your reply; I’m not so familiar with Serial port and RS232 module but I’m really interested in learning this part of vvvv with arduino; I would really appreciate if you can explain me better how can I get my distance values with the sensor; I explain step by step what I did so you can find the wrong part:

1.connect the structure of arduino with sfr05 sensor as explained in http://www.robot-electronics.co.uk/htm/srf05tech.htm, I used the secon configuration (is correct or should I configure it as the first one to use in vvvv with RE232 module?);

2.open arduino processing and load the processin file ping (examples_sensor_ping) on the board

  1. test it on processing through the serial monitor and it works perfectly.
    the signal blinks on the back of the sensor with a red led and also on the board so it sends data and i t gets back the distance.

4.I go in vvvv and out the node RS232, I open the F1 help and vvvv loads the help file;as soon as I enable with the last pin
the node became red (don’t know why). So I closed the arduino (with the ping file loaded)and open again vvv RE232 node, press F1, get the help file.
Now when I enable it it works.

  1. (see the jpg attached)the pin “True if data is available” blinks with the light on the arduino board; the output files from"as value" “Received Bytes” blinks bewteen 2 values null and 0.0000.

the node as value has different setting boolean- SBite… also the input one

How can I set the node to have the values fron the distance sensor?
Is correct what I have done in the provious steps?

thank you again

Tommy

Hi,

everything you are describing 1.-4. sounds ok.
But the IO-Box “Received Bytes” should not flash between null and 0.0000 but between null and some “Byte Values”… perhaps it is flashing to fast, so you can only see the last 0000s !?

However, to see the String you are sending from the arduino you first have to convert the Raw output of the RS232 node to String … after this node you should already see some flickering readable text.
Tokenizer and S+H(String) does the rest.

Markus

pingin.v4p (29.9 kB)

thank you so Much Markus!
It works perfectly

I want to use this system to change input when the values change.

I mean my wish is: when the value is < 10 (just an example) do this operation.
I try to use as value module to use numbers but doesn’t work.
do you have any suggestion?
thank you very much for everything

ToM