profbit
Posts: 45
Joined: Fri May 05, 2017 4:34 am

Using different sensors wiring

Tue Jan 28, 2020 2:31 pm

Good day guys, I'm not quite good in wiring electronics and I can say that I'm just started learning stuff. I would like to ask for a help on how do I power up (best way too if possible) the sensors listed below for checking its state on rpi python. I don't want my pi to break (ofc) thats why.

Here's the list of my sensors:
1x Inductive Sensors: https://www.amazon.com/LJ12A3-4-Z-Appro ... B0719D9FGC
1x Capacitive Sensors: https://www.amazon.com/Capacitance-Prox ... B01G6PBB1E
5x Ultrasonic Sensors: https://www.sparkfun.com/products/15569

It would be a big help if you can show me a diagram.
Thanks for your time!

User avatar
B.Goode
Posts: 10191
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Using different sensors wiring

Tue Jan 28, 2020 3:46 pm

For the last, the use of an HC-SR04 ultrasonic sensor is documented by Raspberry Pi themselves in a tutorial on the web domain that also hosts these forums: https://projects.raspberrypi.org/en/pro ... -computing

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using different sensors wiring

Tue Jan 28, 2020 4:12 pm

A quick look at the 2 proximity sensors show they work at a minimum of 6V and a max of 36V and have a pnp output.

So that suggests a 6V to 36V output which you can't connect directly to the pi gpio or you will kill your pi.

So you will need a potential divider circuit designed to reduce the output to 3.3V.
Or better still an opto isolator circuit to isolate the higher voltage from the gpio.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

profbit
Posts: 45
Joined: Fri May 05, 2017 4:34 am

Re: Using different sensors wiring

Sat Feb 01, 2020 4:04 pm

pcmanbob wrote:
Tue Jan 28, 2020 4:12 pm
A quick look at the 2 proximity sensors show they work at a minimum of 6V and a max of 36V and have a pnp output.

So that suggests a 6V to 36V output which you can't connect directly to the pi gpio or you will kill your pi.

So you will need a potential divider circuit designed to reduce the output to 3.3V.
Or better still an opto isolator circuit to isolate the higher voltage from the gpio.
Hello, I'm interested to this one, however I'm not familiar with the opto isolator (on how it works) even after I've done some searching, it just get things complicated for me as a beginner. Can a resistor function as a voltage divider? I hope you can provide me an example on how it works.

User avatar
B.Goode
Posts: 10191
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Using different sensors wiring

Sat Feb 01, 2020 5:49 pm

Can a resistor function as a voltage divider? I hope you can provide me an example on how it works.
No, a single resistor cannot usefully function as a voltage divider.

The initial paragraph of the Wikipedia article seemed accurate at the time of retrieval: https://en.m.wikipedia.org/wiki/Voltage_divider


(There is nothing Raspberry Pi specific about this. It is simply an application of Ohm's Law.)

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using different sensors wiring

Sat Feb 01, 2020 6:08 pm

These are examples of how to use both a potential divider circuit and an opto isolator to connect the sensor to your pi.

I would consider the opto isolator circuit the better option especially if you are going to be using a sensor voltage nearer the 36V maximum.

Image

You would need to calculate the values of R1 and R2 for the potential divider circuit depending on what voltage the sensor is being powered from while keeping the current drawn within the limits of the sensor output.

You would need to calculate the value of RL in the opto isolator circuit again dependent upon the voltage the sensor is being powered from while keeping the current down to 8-10MA

edit to correct diagram
Last edited by pcmanbob on Sun Feb 02, 2020 10:50 am, edited 1 time in total.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

profbit
Posts: 45
Joined: Fri May 05, 2017 4:34 am

Re: Using different sensors wiring

Sun Feb 02, 2020 5:45 am

pcmanbob wrote:
Sat Feb 01, 2020 6:08 pm
These are examples of how to use both a potential divider circuit and an opto isolator to connect the sensor to your pi.

I would consider the opto isolator circuit the better option especially if you are going to be using a sensor voltage nearer the 36V maximum.

Image

You would need to calculate the values of R1 and R2 for the potential divider circuit depending on what voltage the sensor is being powered from while keeping the current drawn within the limits of the sensor output.

You would need to calculate the value of RL in the opto isolator circuit again dependent upon the voltage the sensor is being powered from while keeping the current down to 8-10MA
If I'm supplying 4x Ultrasonic sensor, 1x inductive proxi, and 1x capactivie proximity sensor with a single power supply. How will the opto isolator wiring will be?

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Using different sensors wiring

Sun Feb 02, 2020 10:23 am

pcmanbob wrote:
Sat Feb 01, 2020 6:08 pm
These are examples of how to use both a potential divider circuit and an opto isolator to connect the sensor to your pi.

I would consider the opto isolator circuit the better option especially if you are going to be using a sensor voltage nearer the 36V maximum.

Image

You would need to calculate the values of R1 and R2 for the potential divider circuit depending on what voltage the sensor is being powered from while keeping the current drawn within the limits of the sensor output.

You would need to calculate the value of RL in the opto isolator circuit again dependent upon the voltage the sensor is being powered from while keeping the current down to 8-10MA
[/qu

From BoyOh I might be right or I might be wrong You show the 3.3v connected to the Opto transistor Base connection
Should It have been connected to the Opto transistor Collector connection
If I'm wrong please except my apology Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using different sensors wiring

Sun Feb 02, 2020 10:51 am

boyoh wrote:
Sun Feb 02, 2020 10:23 am

From BoyOh I might be right or I might be wrong You show the 3.3v connected to the Opto transistor Base connection
Should It have been connected to the Opto transistor Collector connection
If I'm wrong please except my apology Regards BoyOh
Well spotted, just goes to show I am human :lol:

I have posted corrected diagram in original post and repeating it here

Image
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using different sensors wiring

Sun Feb 02, 2020 10:53 am

profbit wrote:
Sun Feb 02, 2020 5:45 am

If I'm supplying 4x Ultrasonic sensor, 1x inductive proxi, and 1x capactivie proximity sensor with a single power supply. How will the opto isolator wiring will be?

For the ultrasonic sensors just follow the examples on line and use a potential divider circuit for each one.

For the proximity sensors you would need one opto isolator circuit for each one.

and please note corrected opto isolator circuit.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

profbit
Posts: 45
Joined: Fri May 05, 2017 4:34 am

Re: Using different sensors wiring

Sun Feb 02, 2020 1:25 pm

pcmanbob wrote:
Sun Feb 02, 2020 10:53 am
profbit wrote:
Sun Feb 02, 2020 5:45 am

If I'm supplying 4x Ultrasonic sensor, 1x inductive proxi, and 1x capactivie proximity sensor with a single power supply. How will the opto isolator wiring will be?

For the ultrasonic sensors just follow the examples on line and use a potential divider circuit for each one.

For the proximity sensors you would need one opto isolator circuit for each one.

and please note corrected opto isolator circuit.
Can you recommend me a good opto isolator circuit available on the market?

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Using different sensors wiring

Sun Feb 02, 2020 1:32 pm

You can use any of the 4N2x or 4N3x range of opto isolators, just about any opto isolator would be ok as you are only using low voltage and minimal current ,

you will have to assemble the opto isolator and resistors on to a prototyping PCB or just some ordinary strip board as you will need to use specific resistors to match the circuit to the voltage used to power the sensors, so ready made ones are unlikely to meet the requirements.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”