Giter VIP home page Giter VIP logo

Comments (6)

LeoColomb avatar LeoColomb commented on June 11, 2024

Thanks for your post!
That said your report miss a lot of information needed to define your specific case:

  • Which Arduino board do you use?
  • What versions of all software & hardware involved?
  • How is the compilation?
  • Did you tried the example? Output?

This list of basic question is not exhaustive, you may add any other detail to help us understand your situation.

from arduino-srf.

AhUhmm avatar AhUhmm commented on June 11, 2024

Yeah, you are right!

First of all thank yoou for your quick reply!

I'll try to be as thorough as possible:
I'm using an Arduino UNO R3 with the latest IDE, all the libraries up to date, including Wire (v.1.0.0). As for the hardware I'm using an SRF08, but I can't provide many more informations about it cause I don't have any datasheet.

I use the AVRISP mkII, and I don't get any error while compiling the example SRF08 included in your library, but on the first try I didn't get any output at all.

I then modified the code of SRF08 example at

#define MAIN_08_ADDRESS (0xF8 >> 1)

and deleted the bitshift operand. That way on the Serial monitor I get the "Sensor SRF08 connected (11)", but no sensor reading, like this:

#define COMMAND_REGISTER  (byte)0x00

#define MAIN_08_ADDRESS 0x7C

I wanted to try your library in the first place because I cannot get readings over 1,5 meters, but I need a 6 meters range.

from arduino-srf.

LeoColomb avatar LeoColomb commented on June 11, 2024

and deleted the bitshift operand

Hmm, OK, why not.

I get the "Sensor SRF08 connected (11)"

Ah! Good! LEDs on the sensor are blinking (at least once)?
Then if it's connected, all you have to manage is the two following constants:

// Setup Analogue Gain
// http://www.robot-electronics.co.uk/htm/srf08tech.html section "Analogue Gain"
#define GAIN_REGISTER 0x09
// Setup Range Location
// http://www.robot-electronics.co.uk/htm/srf08tech.html section "Changing the Range"
#define LOCATION_REGISTER 0x8C

This is where you can manage how the sensor will behave and what data you will receive (range & gain).

but no sensor reading

No output at all? Could you elaborate?

I need a 6 meters range

You will never get 6 meters range. I know it's a bit disappointing, but this is the theoretical limit, not the reality. Maybe 5 meters, 5,5 meters if you're lucky.

from arduino-srf.

AhUhmm avatar AhUhmm commented on June 11, 2024

No output at all? Could you elaborate?

Yes, exactly. The LED behind the sensor blinks only after the setup, and I don't get any sensor readings on the serial monitor after the message stating that a connection has been established.

I also noticed that using your library I have to unplug the Arduino from the USB each time I upload a sketch with some changes int he code, otherwise the I2C communication doesn't work at all. I checked it with this sketch.

You will never get 6 meters range. I know it's a bit disappointing, but this is the theoretical limit, not the reality. Maybe 5 meters, 5,5 meters if you're lucky.

Really? That's a pity... I chose the SRF08 specifically because according to the specifications it is supposed to reach up to that range.

Anyway, I tried the library specifically because it seemed like the most straightforward way to change those registers, and the constants used in the SRF08 examples are the settings I need for my project!

from arduino-srf.

LeoColomb avatar LeoColomb commented on June 11, 2024

Yep, I2C communication is not really easy with Arduino, don't know why. Maybe this is the case only with SRF08 sensors.
At this point, I can't help you anymore, you already know everything. First try reducing the range at the minimum, change constants, to get at least some readings.

If you find something that can be improved, or just something interesting, feel free to come back here! 😃

from arduino-srf.

AhUhmm avatar AhUhmm commented on June 11, 2024

A quick update. I checked your library also with a SRF10, and I cannot get past the setup message.
With the SRF example that comes with the Wire library I don't have any problems in getting readings from the sensor.

Anyway, would you mind telling me how I could write on the registers to change the Gain and Range?Is it something like this:

Wire.beginTransmission(ADDRESS);
Wire.write(byte(0x02);
Wire.write(RANGE);
Wire.endTransmission();

This has to be set before the Unit (cm, inch, mS), right?

from arduino-srf.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.