-2

Is there a way to connect a data output pin from an HT12D to an Arduino or ESP8266-12e input pin, then sense when the data pin is activated so I can have the Arduino or ESP8266-12e do something like turn on an output pin?

3
  • 1
    What's a HT12D?
    – Majenko
    Sep 2 '20 at 14:06
  • Sure, as long as the voltage levels are ok for the Arduino or ESP, just connect the data pins to digital input puts of the Arduino or ESP.
    – chrisl
    Sep 2 '20 at 15:29
  • The ESP is 3.3v and I think the HT12D is 5v. Could I use resisters as voltage divider. What kink of code would I use to recognize the input? HT12D is a unit that takes an RF signal and makes it a digital signal I think. Sep 2 '20 at 16:37
1

I am afraid I could not understand your question properly. But maybe, the answer is YES, if ...

First of all, OUTPUT pins, cannot be turned ON and turned OFF, however, you can start or stop READING that particular OUTPUT PIN based on another INPUT pin value.

If you want to connect HT12D decoder to any arduino or ESP, you must be aware to use same voltage level between IO PINS, a good approach is to use a I2C bi-directional level shifter.

if(INPUT_PIN_VALUE >= SOME_VALUE)
{
   digitalRead(PIN)
}
1
  • on the ESP I can make a pin D5 HIGH based on the reading of another input pin from the HT12D. So if I used a l2C to make the 5v from the HT12D computable with the 3.3v ESP. I could read the input level and then make another pin go HIGH in reaction. digitalRead(D5); if(D5>=SomeValue){ digitalWrite(D6,HIGH); Sep 2 '20 at 17:56
0

Disclaimer: In this answer I'm using ESP and Arduino interchangeably, as if they were the same. They are in context this question, but not in general.

First: According to the datasheet of the HT12D, the supply voltage can be between 2.4V and 12V, so you could just provide it with the 3.3V of your ESP. That way the output pins will also run on 3.3V. Then you can simply run a wire each from an output of the chip to a digital input pin of the Arduino.

Though you then should also provide your receiver chip with 3.3V. If that is not possible, you can provide the HT12D with 5V and use simple voltage dividers on each output to break the voltage down to 3.3V. That places restrictions on the transmission speed, but I don't think, that this is relevant here, as the outputs are more meant as momentary state outputs, not data transmission outputs. In that case you connect the output of the voltage dividers to one digital input pin on the Arduino each.

How to read the data:

The chip will read the data from the receiver on its Din pin. When it has found a valid transmission for the used address (which is configured through the address pins), then it will pull the VT pin to HIGH and output the new data on the pins. The datasheet says:

The HT12D, on the other hand, provides 4latch type data pins whose data remain unchanged until new data are received.

Let's imagine, that you have send the pattern HIGH, LOW, HIGH, LOW. The HT12D will see this as valid data and set it's outputs to this pattern. The VT pin is pulled high to show, that new valid data arrived. Now you can read this pattern into the Arduino via multiple digitalRead() calls, one for each output pin of the HT12D.

The surrounding code depends on your needs. For example you could just read the pins continuously again and again, every time just outputting corresponding on the data. For example like this:

void loop(){
    if(digitalRead(HT12D_pin1)) digitalWrite(LED_pin, HIGH);
}

Or even easier:

void loop(){
     digitalWrite(LED_pin, digitalRead(HT12D_pin1));
}

Or you could also read the VT pin of the HT12D and only do something, if it is HIGH. That way you only act, if there is valid data received.


For more info you really need to improve your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.