Pressure sensor and input trough optocoupler
-
Hi all,
I have a hard time asking this but if I don't I will never get this working.
The situation is:
I have 7points of 230v to check in my heating system and one pressure sensor, I have optocouplers installed so basically the signal is an 0 or an 3,3v to read. The pressure sensor is an cheap one and reads from 0,5 to 5volt. At this moment I have nothing wired up to my arduino yet so that's still flexible.How do I make an working script for a arduino mega so I can read it trough the usb on my PI with Domticz? If someone can put me in the right direction that would be great
-
@Olaf-Jacobs If it's a typical screw in pressure sensor from China I've found they work on 3.3v fine. You lose 10% voltage off the bottom and top, so from your ADC reading of 1023 full scale to Vcc you lose 204.6 from the ADC reading. So your pressure range is 818.4 increments of the sensor pressure value... Voila...
When you do a float calculation on the pressure value, you simply send it in to however many decimal points you want (rounded up 0.5, 0.05, 0.005 etc)
I have 5 bar and psi units down to 5psi for a tank all working perfectly.
Hope this helps
-
@zboblamont Thanks for your reply, that sounds like it gets a little easier.
I was planning on using this script https://www.mysensors.org/build/binary for the 7 inputs but how can I read this only over serial, how do I use more then only pin 3 and how do I integrate an script to read that pressure sensor?
I hope to make some time this weekend..
-
@Olaf-Jacobs It's a straight analogue read on a single ADC pin relative to Vcc and ground of the Arduino Node.
In my case it's a pro-mini, the ADC pin in this example earlier defined as "Pressure", the result radioed in only if the ADC reading has changed. Three other binary inputs for contactors are polled every second on separate digital pins (one of which is pin 3), which uses all 4 pins available on this pro-mini due to the radio etc.if ((!hidro&&!Hidro&&(counter2>=132))||initialise){ int incoming=analogRead(Pressure); if (prevolume!=incoming){ prevolume=incoming; sleep(50); float tankvolume=(((incoming-102.3)*6.704199635)+0.5);//5psi sensor send(msg8.set(tankvolume,0));//This is actual volume sleep(100); }}
I'm not clear on the rest of what you're trying to incorporate or what pin 3 (digital interrupt) has to do with it, the pressure sensor signal goes to an analogue pin to enable the voltage to be read.
Suggested Topics
-
💬 Extremely Simple Arduino Pro-Mini LoRa Water Leak Detector
OpenHardware.io • 26 Nov 2017, 01:53 • openhardware.io 4 Mar 2018, 16:24 -
ioBroker / NEW Controller Development / collection of FEATURES you/we need
My Project • 1 Feb 2016, 12:46 • maxtox 21 Mar 2016, 19:28 -
💬 Automatic stairs led lighting arduino shield
OpenHardware.io • 3 Apr 2017, 07:58 • openhardware.io 2 Sept 2019, 19:35 -
💬 Epi 32U4 Arduino-compatible, 4-layer version
OpenHardware.io • 4 Feb 2023, 13:41 • openhardware.io 4 Feb 2023, 13:41 -
Arduino & CC3000 Wifi & NRF24L01+ over SPI
Hardware • 12 Sept 2014, 22:16 • jesse 6 Jan 2016, 01:28 -
💬 Single board computer UPS
OpenHardware.io • 3 Apr 2018, 14:11 • openhardware.io 28 Jul 2018, 12:33 -
Soil Tensiometer Sensor Network
My Project • 16 Feb 2015, 19:19 • aur 17 Jun 2016, 11:35