Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. Pressure sensor and input trough optocoupler

Pressure sensor and input trough optocoupler

Scheduled Pinned Locked Moved Domoticz
arduino
4 Posts 2 Posters 32 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Olaf JacobsO Offline
    Olaf JacobsO Offline
    Olaf Jacobs
    wrote on last edited by
    #1

    Hi all,

    I have a hard time asking this but if I don't I will never get this working. :face_palm:

    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 :bow:

    zboblamontZ 1 Reply Last reply
    0
    • Olaf JacobsO Olaf Jacobs

      Hi all,

      I have a hard time asking this but if I don't I will never get this working. :face_palm:

      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 :bow:

      zboblamontZ Offline
      zboblamontZ Offline
      zboblamont
      wrote on last edited by
      #2

      @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

      1 Reply Last reply
      0
      • Olaf JacobsO Offline
        Olaf JacobsO Offline
        Olaf Jacobs
        wrote on last edited by
        #3

        @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..

        zboblamontZ 1 Reply Last reply
        0
        • Olaf JacobsO Olaf Jacobs

          @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..

          zboblamontZ Offline
          zboblamontZ Offline
          zboblamont
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          12

          Online

          11.7k

          Users

          11.2k

          Topics

          113.0k

          Posts


          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • MySensors
          • OpenHardware.io
          • Categories
          • Recent
          • Tags
          • Popular