V_VOLTGEM EXAMPLE



  • Hello guys, I use mysensors with the home assistant and I'm having trouble using the library to read voltage. I have motion sensors connected to the analog ports of the mega arduino. I can't read the doors. Would anyone have an example?



  • I am not sure I understand the problem. Are you saying that all the pins on your Arduino Mega are occupied ("I have motion sensors connected to the analog ports of the mega arduino") and thus you cannot access the analog pins?

    As far as examples, have you looked at Build main link in header?

    I am not sure how "I can't read the doors" factors in?



  • Hello
    Let me explain further. I was using the mqtt protocol for communication between Arduino and HA, the digital ports I use for relays and switches, the analog ports I use for motion sensors. I decided to change my automation and use the mysensors library, this is working very well for relays and switches. I am having a hard time reading the analog pins for the motion sensors. I was not able to have any success with V_Voltage or S_Multimeter. So I would need help with this.



  • @amkochaki said in V_VOLTGEM EXAMPLE:

    the analog ports I use for motion sensors

    What kind of motion sensors are you using?

    The very common HC-SR501 type are digital. So if using digital type of sensors, I think it should just be a matter of setting the pin accordingly.

    But if using some motion sensors with analog outputs (do such things exist?) would be a different scenario. MySensors sketch is written for digital.



  • @TRS-80 hello. My motion sensores are the same of my alarm system. Are connected on analogic pins. So I need that Arduíno read voltage of the sensores.



  • @amkochaki You imply the sensor sends two different voltages, one for standby and one for active, perhaps you might establish what these voltages are for each condition.
    All your ADC is doing is measure the voltage, your sketch takes that value and converts that to a logical 1 or 0, standby/active.
    If the voltage swing is large, say 5v for stable and 1v for triggered, perhaps conversion via resistor divider can provide a logical 1 or 0 input simplifying the process ?



  • I am sorry but your reply is still not very helpful. In general I feel like this is an interrogation session in order to discover relevant information, making the whole process much more difficult than necessary. Please keep in mind that we know absolutely nothing about your system other than what you tell us, and if we instead substitute assumptions, that can lead us to wrong conclusions. In other words, please be more forthcoming with relevant information so we don't have to keep playing this cat and mouse game. 🙂

    @amkochaki said in V_VOLTGEM EXAMPLE:

    My motion sensores are the same of my alarm system.

    I don't think that you mentioned anything about what is your alarm system, how it works, etc. therefore this statement is meaningless (at least to me). Perhaps I missed something?

    @amkochaki said in V_VOLTGEM EXAMPLE:

    Are connected on analogic pins.

    Perhaps you are unaware, but the analog pins on the arduino can also be used as Genral Purpose Input Output (GPIO) pins, aka digital. So again, this statement still does not clarify whether your sensors are analog or digital...

    @amkochaki said in V_VOLTGEM EXAMPLE:

    So I need that Arduíno read voltage of the sensores.

    Yes, of course. But (at least to me) we still have not determined whether they are analog or digital... Both are measuring voltages, the question is how...

    Perhaps you are unfamiliar with difference between analog and digital? I don't like to assume anyone's knowledge level, which can lead to wrong conclusions. On the other hand, I don't want to insult anyone, either... 😉


Log in to reply
 

Suggested Topics

  • 4
  • 9
  • 8
  • 17
  • 2
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts