nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Possible to read potentiometer values from a sensor?

Sun Dec 03, 2017 10:34 pm

I am using a SW420 sensor that has an onboard potentiometer. I can get the output of the motion sensor has a HIGH or LOW voltage based on the adjustment of the potentiometer. But, how do I quantify the value that the potentiometer is set to?

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 2:18 am

nsuser wrote:
Sun Dec 03, 2017 10:34 pm
I am using a SW420 sensor that has an onboard potentiometer. I can get the output of the motion sensor has a HIGH or LOW voltage based on the adjustment of the potentiometer. But, how do I quantify the value that the potentiometer is set to?
You can't with the pins that are broken out. The only way (without additional circuitry) would be with a multimeter to measure the resistance when the unit is powered down.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 4:39 am

I am trying to make a simple science project with dependent and independent variables. Dependent variable is the LOW or HIGH voltage that is output from the pin. Struggling a bit with the independent variable as I was hoping to use the potentiometer value to measure the resistance.

Could use some ideas for the independent variable with something that can be measured.

klricks
Posts: 5838
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 1:36 pm

nsuser wrote:
Mon Dec 04, 2017 4:39 am
I am trying to make a simple science project with dependent and independent variables. Dependent variable is the LOW or HIGH voltage that is output from the pin. Struggling a bit with the independent variable as I was hoping to use the potentiometer value to measure the resistance.

Could use some ideas for the independent variable with something that can be measured.
Make sure the voltage of High is 3V3 and NOT 5V.

Reading the value of a potentiometer requires an Analog to Digital converter add on.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 2:31 pm

klricks wrote:
Mon Dec 04, 2017 1:36 pm
nsuser wrote:
Mon Dec 04, 2017 4:39 am
I am trying to make a simple science project with dependent and independent variables. Dependent variable is the LOW or HIGH voltage that is output from the pin. Struggling a bit with the independent variable as I was hoping to use the potentiometer value to measure the resistance.

Could use some ideas for the independent variable with something that can be measured.
Make sure the voltage of High is 3V3 and NOT 5V.

Reading the value of a potentiometer requires an Analog to Digital converter add on.
What specifically should I buy for this?

Would this work? https://learn.adafruit.com/raspberry-pi ... s?view=all

Or is there something you suggest?

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 2:35 pm

asandford wrote:
Mon Dec 04, 2017 2:18 am
nsuser wrote:
Sun Dec 03, 2017 10:34 pm
I am using a SW420 sensor that has an onboard potentiometer. I can get the output of the motion sensor has a HIGH or LOW voltage based on the adjustment of the potentiometer. But, how do I quantify the value that the potentiometer is set to?
You can't with the pins that are broken out. The only way (without additional circuitry) would be with a multimeter to measure the resistance when the unit is powered down.
I have a multimeter https://www.amazon.com/AstroAI-Digital- ... multimeter But, unclear on how to measure this.

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

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 5:03 pm


You can't with the pins that are broken out. The only way (without additional circuitry) would be with a multimeter to measure the resistance when the unit is powered down.
You are not guarantee to get an accurate resistance reading even using a meter with the board powered down because the potentiometer is still in circuit so your reading would be influenced by other components in the circuit.
Remember we want information.......................no information no help
The use of crystal balls & mind reading is not supported

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 6:13 pm

pcmanbob wrote:
Mon Dec 04, 2017 5:03 pm

You can't with the pins that are broken out. The only way (without additional circuitry) would be with a multimeter to measure the resistance when the unit is powered down.
You are not guarantee to get an accurate resistance reading even using a meter with the board powered down because the potentiometer is still in circuit so your reading would be influenced by other components in the circuit.
Ok, Will take that into account. But, how do I get this reading in the first place using a multimeter?

klricks
Posts: 5838
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 6:20 pm

nsuser wrote:
Mon Dec 04, 2017 2:35 pm
asandford wrote:
Mon Dec 04, 2017 2:18 am
nsuser wrote:
Sun Dec 03, 2017 10:34 pm
I am using a SW420 sensor that has an onboard potentiometer. I can get the output of the motion sensor has a HIGH or LOW voltage based on the adjustment of the potentiometer. But, how do I quantify the value that the potentiometer is set to?
You can't with the pins that are broken out. The only way (without additional circuitry) would be with a multimeter to measure the resistance when the unit is powered down.
I have a multimeter https://www.amazon.com/AstroAI-Digital- ... multimeter But, unclear on how to measure this.
Refer to the schematic here: https://www.elecrow.com/vibration-senso ... p-525.html
With the circuit powered on you will measure voltage with the black meter lead on ground and the red meter lead on the 'wiper' pin of the Pot. This would be the same connection point where you would connect an A to D if you are going to use that.

It is not clear to me why you need to monitor the pot setting or what you would do with that information?
Normally the sensitivity would be adjusted once with the pot, then left alone.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Stretch w/ Desktop OS.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 7:14 pm

It is not clear to me why you need to monitor the pot setting or what you would do with that information?
Normally the sensitivity would be adjusted once with the pot, then left alone.
Trying to measure voltage changes for different levels of sensitivity for a science project.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Mon Dec 04, 2017 7:15 pm

From a data standpoint, I dont have anything other than HIGH and LOW voltage from my output. Trying to get more data and running out of ideas.

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Possible to read potentiometer values from a sensor?

Tue Dec 05, 2017 1:03 am

nsuser wrote:
Mon Dec 04, 2017 7:15 pm
From a data standpoint, I dont have anything other than HIGH and LOW voltage from my output. Trying to get more data and running out of ideas.
Looking t the circuit diagram:
-The pot is being used as a potential diver, not as a variable resistor (all 3 terminls as opposed to 2 are used).
-Although the pot is labelled as sensitivity, it's more really a threshold over which it'll trip. The more voltage applied to the +ve input of the voltage comparator (via the potential divider) the higher the output from the sensor will have to be to trigger it (see Fig. 3 here on how it works).

So running a wire from the wiper of the pot to an ADC and reading the voltage you can the plot what amount of vibration will trigger it (from minimal shaking at 0 to a lot at VCC (which can be Pi safe at 3v3)).

You'll also need a device to produce variable vibration levels...

Another approach would be to use a light level sensor which you can couple with an LED driven with PWM to easily manage the stimulus.

btidey
Posts: 1593
Joined: Sun Feb 17, 2013 6:51 pm

Re: Possible to read potentiometer values from a sensor?

Tue Dec 05, 2017 12:23 pm

One thought if you are trying to use this for experimental purposes is to disconnect the potentiometer and instead feed the comparator input with a PWM signal from the Raspberry.

This then allows you to change the sensitivity under software control.

As the PWM output simulates an analogue output by changing the duty cycle of a pulsed output you would need to put a simple RC filter in between the PWM output and the comparator.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Tue Dec 05, 2017 7:39 pm

Can you please help me understand this? How can i run a wire from the pot? It looks like a screw that can be changed to change the sensitivity. How do I run wires from there? Also, Where is the wiper in this?

For now, reading the voltage is a great start if you can explain how that can be achieved. I have the SW420 sensor, multimeter and the code now, but now sure how to check the voltage. One recommendation I got earlier from someone was:


"Refer to the schematic here: https://www.elecrow.com/vibration-senso ... p-525.html
With the circuit powered on you will measure voltage with the black meter lead on ground and the red meter lead on the 'wiper' pin of the Pot. This would be the same connection point where you would connect an A to D if you are going to use that.
"
So running a wire from the wiper of the pot to an ADC and reading the voltage you can the plot what amount of vibration will trigger it (from minimal shaking at 0 to a lot at VCC (which can be Pi safe at 3v3)).

You'll also need a device to produce variable vibration levels...

User avatar
Burngate
Posts: 5443
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Possible to read potentiometer values from a sensor?

Wed Dec 06, 2017 9:46 am

Bourns 3362P-01.jpg
Bourns 3362P-01.jpg (4.65 KiB) Viewed 1101 times
Bourns 3362P-02.jpg
Bourns 3362P-02.jpg (4.46 KiB) Viewed 1101 times
Solder the wires to the pins on the under-side of the board.

nsuser
Posts: 25
Joined: Mon Sep 25, 2017 4:41 pm

Re: Possible to read potentiometer values from a sensor?

Thu Dec 14, 2017 3:33 am

nsuser wrote:
Tue Dec 05, 2017 7:39 pm
Can you please help me understand this? How can i run a wire from the pot? It looks like a screw that can be changed to change the sensitivity. How do I run wires from there? Also, Where is the wiper in this?

For now, reading the voltage is a great start if you can explain how that can be achieved. I have the SW420 sensor, multimeter and the code now, but now sure how to check the voltage. One recommendation I got earlier from someone was:


"Refer to the schematic here: https://www.elecrow.com/vibration-senso ... p-525.html
With the circuit powered on you will measure voltage with the black meter lead on ground and the red meter lead on the 'wiper' pin of the Pot. This would be the same connection point where you would connect an A to D if you are going to use that.
"
So running a wire from the wiper of the pot to an ADC and reading the voltage you can the plot what amount of vibration will trigger it (from minimal shaking at 0 to a lot at VCC (which can be Pi safe at 3v3)).

You'll also need a device to produce variable vibration levels...
I am able to read the voltage using the multimeter. Based on the sensitvity, I can see values between 1V to 3V. Now, How do I read the strength of the vibration (Strength of the pulse)? I saw code for C: http://www.theorycircuit.com/sw-420-vib ... interface/
Not sure how to do the same in python

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 10 guests