GP2Y0A41SK0F Sharp Distance Measuring Sensor

Will GP2Y0A41SK0F or GP2Y0A21YK0F Sensors works on 3.3v (regulated of spark core)
Is it safe to do so ?
The max output of the sensor is 3.1v 80cm – 0.2 v 10cm

but they take 4.5-5v output voltage . So would they run from 3.3v of the spark and if yes is it safe to do so ?

Lower voltage is always ok :wink:

If it’s for sure a output voltage of maximum 3.1V, you can safely connect to an analog pin on the :spark: core while powering the sensor via the Vin pin if you are on USB

1 Like

Why powering the sensor via the Vin And not on 3.3* ?

Opps my bad. I read your post wrongly.

It’s actually the other way round! The output voltage is 4.5-5V so the core analog pins can’t handle them.

Also, i checked the supply voltage for them and the minimum is like 4.5V so the Vin which gives 5v on USB will work fine.

I’m not so sure if using a level shifter from 5V to 3.3V would be ideal though.

Let’s see what others say :wink:

Because the data sheet says it needs a supply voltage of 4.5V - 5.5V. The 3.3V supply isn’t enough for its input requirements. It might work, but it would definitely be way out of spec, and you might not get reliable readings.

1 Like

No, the output voltage seems to max out around 3.1V – see the graph on page 5 of the PDF.

@kennethlimcp, you DID read the datasheet wrongly… the second time! Vcc is 4.5 - 5.5V and Vout is ~3.1V max.

@Gentmat, I would not try and power this off either the Spark 3.3V supplies as it will greatly affect the module’s operation and output, if it works at all, and will draw 30-40ma on those supplies. Use the Vin pin to supply the module at 5V and hopefully, the output does not rise about 3.3V :stuck_out_tongue:

The datasheet has two things related to the output:

  • Typically the output is less than 3.3V for all the sensing range.
  • The maximum output voltage is Vcc+0.3V or 5.8V with a 5.5V supply.

I think it will work OK with the output connected to an analog input since the voltage is typically OK, but if you really want to have a robust design, you should add something to protect the core input. An op-amp voltage follow powered from the 3.3V rail? A 3.3V zener diode? A resistive voltage divider? All could work, but a 1k over 1k resistor voltage divider seems easiest.

                         Core Analog Input
                    1k            |          1k
Sensor out--------/\/\/\/\--------+-------/\/\/\/\--------GND

1 Like

Okay Guys thanks a lot . BKO your always the biggest help ! thanks again.

Question (Might Be a stupid one) :smile:

1-To Avoid resistors or voltage dividers and so , I read that digital input are 5v tolerant on spark core … Could i use these digital pins to read this sensor and i ll be safe ? :blush: Sorry if that is ignorant question I’m just a new with the stuffs and i don’t understand why wouldn’t a analoge sensor work on a digital .

2- In the data sheet i saw that this sensor use a voltage divider before sending the signal … so why is it risky to depend on their voltage divider ?

1 Like
  1. You can’t use a digital input to read this sensor. The sensor’s output is a voltage that varies depending on the distance. With a digital read, you only get LOW or HIGH, depending on whether the input voltage exceeds a certain threshold. So if it hit the threshold when an object was about 50cm away (just an example), all you’d know is that the object was either closer than 50cm or farther than 50cm. You wouldn’t be able to know the precise distance.

  2. The voltage divider in the sensor isn’t stopping the output from going over 3.3V.

@bko is just helping you be extra cautious. In theory, the sensor’s output normally should be within the tolerable limits for the Spark inputs. But it says it can go higher. So just in case it was higher, he’s suggesting ways to limit it for safety, so you don’t burn up your Spark.

I’m guessing the main danger would be if a highly reflective object was near the sensor.

In any case, once you have things wired up, you will probably want to take some readings from the sensor to see what values you get in the Real World with objects at various distances, and see if you need to do any extra calibration math (assuming that you want to get real distance values, and don’t just need fuzzy proximity info).

Thanks Dougal,
My problem is that i am doing a product , many of it . So wiring resistors will take time .
In that case should i build a customise PCB with resistors ? to be clean and wired well .
what do u advise

I’m just a hobby tinkerer, and there are others here more highly qualified to make recommendations.

But I think if it was me, I would probably start with logging some actual output from a sample of those sensors. Power them with their max 5.5V, and use a voltmeter to record the output under various real-world conditions to see if they ever exceed 3.3V on the output. In particular, I’d see how they behave with highly reflective (white or mirrored) surfaces placed very close to the sensor.

Then if you see output conditions that you need to worry about, implement some sort of voltage limiting as @bko suggested, and re-run the tests until you’re sure you have the most cost-effective solution for your expected conditions.

Hi @Gentmat

Can I ask how you were going to hookup the sensor the Spark core for your product before discovering this issue? Do you already have a PCB?

If you don’t already have a PCB, you will likely need one for a product–I can’t really imagine another way to make quality connections and have mechanical security of the parts. The Spark core does not have any mounting holes, for instance, so right there, you will need some other PCB carrier at least. In fact since the sensor needs to be out where it might get exposed to ESD, I would think you would want a series resistor and a capacitor protect the core inputs anyway.

If you have a PCB designed already and are worried about the rework, you can try it without the resistors, or add a zener diode for protection against over-voltage in the holes where you connect the sensor or on the back of the sensor connector, depending on how you connect. A 1N4728A 3.3V zener would would work well, just remember it gets connected “backwards” so that it is reverse biased and the cathode goes to the sensor input and the anode goes to ground.

1 Like

GUYS Thank you all .

bko i will send you a private message . because my question wont help the community its just personel product wiring.
Thank you again all and specially BKO always helps !! i appriciate it .