leocolomb / arduino-srf Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Arduino interfacing with sonar sensor SRF
Home Page: https://playground.arduino.cc/Main/SonarSrf08
License: MIT License
๐ฅ Arduino interfacing with sonar sensor SRF
Home Page: https://playground.arduino.cc/Main/SonarSrf08
License: MIT License
The library need to be aware of gain and location to add a delay between ping and and listener.
From https://www.robot-electronics.co.uk/htm/srf08tech.html
ANN mode (Artificial Neural Network) is designed to provide the multi echo data in a way that is easier to input to a neural network, at least I hope it is - I've not actually done it yet. ANN mode provides a 32 byte buffer (locations 4 to 35 inclusive) where each byte represents the 65536uS maximum flight time divided into 32 chunks of 2048uS each - equivalent to about 352mm of range. If an echo is received within a bytes time slot then it will be set to no-zero, otherwise it will be zero. So if an echo is received from within the first 352mm, location 4 will be non-zero. If an object is detected 3m away the location 12 will be non-zero (3000/352 = 8) (8+4=12). Arranging the data like this should be better for a neural net than the other formats. The input to your network should be 0 if the byte is zero and 1 if its non-zero. I have a SOFM (Self Organizing Feature Map) in mind for the neural net, but will hopefully be useful for any type.
Location 4 Location 5 Location 6 Location 7 Locations 8 - 35 0 - 352mm 353 - 705mm 706 - 1057mm 1058 - 1410mm and so on Locations 2,3 contain the range of the nearest object converted to inches, cm or uS and is the same as for Ranging Mode.
Hi,
As I said, I tested the two versions. I give you the results :
v1.0 : Arduino doesn't compile the file. I have tried to modify .cpp and .h files, I just removed "//" which were in front of commands, but it gave the same result :
SRF08.ino: In function 'void setup()':
SRF08:30: error: no matching function for call to 'SonarSRF08::connect()'
C:\Program Files (x86)\Arduino\libraries\ArduinoSRF21/SonarSRF.h:30: note: candidates are: void SonarSRF::connect(int)
SRF08:31: error: no matching function for call to 'SonarSRF08::changeAddress(int, int&, int, int)'
C:\Program Files (x86)\Arduino\libraries\ArduinoSRF21/SonarSRF.h:34: note: candidates are: void SonarSRF::changeAddress(int)
SRF08.ino: In function 'void loop()':
SRF08:42: error: 'class SonarSRF08' has no member named 'setUnit'
SRF08:46: error: 'class SonarSRF08' has no member named 'setRegister'
SRF08:48: error: 'class SonarSRF08' has no member named 'readData'
v2.1 : Arduino compile the files but it does'nt seem to work good. With the resistors, the serial monitor only prints
"Left SRF02 US-Sensor ".
Without them, it prints :
Left SRF02 US-Sensor
-1
Right SRF02 US-Sensor
11
Main SRF08 US-Sensor
-1
I precise I made EEPROM clear before testing each program. I tried these programs with an arduino uno and a srf 08 sonar.
Thank you for your help,
auguste95.
Hello,
I have a problem with my srf 08 sonar and your program. I copy the Arduino-SRF-Master in the "libraries" file of arduino, otherwise it didn't want to compile the example you give at all. So I retried to compile your example after copying, but I received some errors :
C:\Program Files (x86)\Arduino\libraries\ArduinoSRFmaster\SonarSRF08.cpp:26: error: no 'void SonarSRF08::setUnit(int, int, char, int, int)' member function declared in class 'SonarSRF08'
C:\Program Files (x86)\Arduino\libraries\ArduinoSRFmaster\SonarSRF08.cpp:44: error: no 'void SonarSRF08::setRegister(int, int)' member function declared in class 'SonarSRF08'
C:\Program Files (x86)\Arduino\libraries\ArduinoSRFmaster\SonarSRF08.cpp:54: error: no 'int SonarSRF08::readData(int, int)' member function declared in class 'SonarSRF08'
Did I make forget something I had to do before compiling ?
Please, could you help me ?
Thank you very much,
auguste95.
In the file "Arduino-SRF/src/SonarSRF.cpp" there is a while (Wire.available() < length);
after the Wire.requestFrom(). That line can be removed, because there is nothing to wait for.
When the Wire.requestFrom() returns, the I2C transaction on the bus has completely finished and the received data is waiting in a buffer in the Wire library.
I have tried to use this library with a SRF08, and tested the corresponding example, but I don't even get the "Sensor X not connected..." message on the serial monitor.
Am I missing something?
I checked the I2C address of my sensor and then changed it on the code but nothing happens.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.