Piezo Sensor + Wifi + Database

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
dewildequinten
Posts: 3
Joined: Sun Dec 02, 2018 5:53 pm

Piezo Sensor + Wifi + Database

Post by dewildequinten » Sun Dec 02, 2018 6:25 pm

Hi,

I'm starting a project where I want to
1: Read the analog input of vibrations of a Piezo Sensor almost continuously or at least every time the pressure is relevant (from a certain range), I have a voltage divider board and a resistor setup to avoid damaging the board. Though the code I'm using isn't working as expected...

[code]
from machine import ADC

adc = ADC(0) # create ADC object on ADC pin
adc.read() # read value, 0-1024
[/code]

I get [code]>>> 3[/code] all the times even with an other sensor (rain sensor)

2. I want that data send to a local network computer that can store the data that's been read. And I have no idea to approach this, php, firebase?? And having hard time finding stuff about this for micropython online. Our I'm not using the right search terms.

Any help would be kindly appreciated.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Piezo Sensor + Wifi + Database

Post by Roberthh » Sun Dec 02, 2018 7:39 pm

We need a little bit more "flesh to the bones" to understand.
What do you expect and what do you get (You mention: 3)? How fast are the transitions you want to catch?
Which sensor are you using and how do you interface it to the board.
Which board are you using?
And, even it may not be important here, which version of the firmware are you using.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: Piezo Sensor + Wifi + Database

Post by kevinkk525 » Sun Dec 02, 2018 7:45 pm

Can we remove the other duplicate thread?
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Piezo Sensor + Wifi + Database

Post by pythoncoder » Mon Dec 03, 2018 6:44 pm

Done.
Peter Hinch
Index to my micropython libraries.

dewildequinten
Posts: 3
Joined: Sun Dec 02, 2018 5:53 pm

Re: Piezo Sensor + Wifi + Database

Post by dewildequinten » Wed Dec 05, 2018 9:18 pm

<r><QUOTE author="Roberthh" post_id="32366" time="1543779551" user_id="601"><s>
Roberthh wrote:
Sun Dec 02, 2018 7:39 pm
</s>
We need a little bit more "flesh to the bones" to understand.<br/>
What do you expect and what do you get (You mention: 3)? How fast are the transitions you want to catch?<br/>
Which sensor are you using and how do you interface it to the board.<br/>
Which board are you using?<br/>
And, even it may not be important here, which version of the firmware are you using.
<e>
</e></QUOTE>

Yeah the "3" is a weird one but I keep getting three. I'm going to rewire everything and show the schematics of it. <br/>
The transitions should be "as fast as possible", I mean the more data it can collect the better but within the limits of the Wemos D1 mini.<br/>
<br/>
Firmware: <URL url="https://micropython-on-wemos-d1-mini.re ... <LINK_TEXT text="https://micropython-on-wemos-d1-mini.re ... setup.html">https://micropython-on-wemos-d1-mini.re ... TEXT></URL>
Is where I got the firmware from.

I'm reading the wemos with ampy.

I find it in general very hard to find an example that just reads a piezo (and shows which resistor to use to keep the voltage between 0-1v , or if I should use the ADS1115 to read the analog voltage) and if micropython is faster or better to acces a database then general c. So many variations on how to do it and none that shows me the specifics I need for my project. Or maybe i'm staring blind from all the searching ^^
</r>

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Piezo Sensor + Wifi + Database

Post by Roberthh » Thu Dec 06, 2018 6:24 am

Th eWemos D1 mini has a built-in resistor divider of 100k + 220k, which changes the analog range at the board level to 0-3.2V. This is intended as support for users, in your case it is bad. The impedance is way too low for a piezo sensor. You have either to use a buffer amplifier or remove the 100k resistor.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Piezo Sensor + Wifi + Database

Post by pythoncoder » Fri Dec 07, 2018 6:45 am

I'm not familiar with piezo vibration sensors but, as @Roberthh says, piezoelectric devices are extremely high impedance. They can also produce high voltages. To interface one to an ADC there needs to be a DC bias so that the mean level is in the middle of the ADC range. I would also want to see voltage limiting to avoid the risk of damaging the ESP8266. A suitably designed amplifier/buffer is the answer (assuming the sensor doesn't have one built-in).

@dewildequinten Can you post a link to the sensor?
Peter Hinch
Index to my micropython libraries.

dewildequinten
Posts: 3
Joined: Sun Dec 02, 2018 5:53 pm

Re: Piezo Sensor + Wifi + Database

Post by dewildequinten » Mon Dec 10, 2018 10:24 pm

Hi this is the link for the piezo: https://www.rapidonline.com/RVFM-ABT-44 ... B#techSpec

Could you show me a diagram or schematic of what you main, because I don't really get what you are saying (language wise (i'm dutch)).

Post Reply