I have a project that consists of 2 Arduinos as a transmitter and a receiver. I have no problem at the transmitter Arduino, but my problem is at the receiver, where I get input as a binary sequence of 4 bits and translate them using an if-else statement. The problem is that when reading the binary at the if-else statement, I have interference between the second and first statements; when Orange LED is supposed to be HIGH, I have Orange and Red alternating between HIGH and LOW; this also happens when Yellow is supposed to be HIGH; I have Yellow and Green alternating between HIGH and LOW. I figured that this happens because the first bit at the orange and red are both 0, and at the yellow and green are both 1. But I don't know how to solve this problem, and read the whole 4 bits before making a decision? Help please.
Because I will modulate and transmit the output through a channel from the first Arduino until it reaches the second, that's why I can't use conventional methods.
looks like you want to read a 4 bit sequence.
i'll assume you expect bits to be 10 msec apart
how do you know when the sequence starts? is there a start bit what is always the opposite state of the input than the state of the start bit?
how do you synchronize receiving data to the transmission data? do you repidly (more frequently than every 10 msec) to recognize the start bit and then delay for 5 msec to read the first bit and then delay by 10 msec for every following bit?
isn't there a device on the chip that alread does this?
I'm trying to build two separate devices connected by a powerline cable, the output from the transmitter Arduino will be received at the receiver Arduino.
In the Tinkercad simulation, I have simply connected the output from the transmitter to the input at the receiver without going into the details of the modulation, channel, and de-modulation process.
Actually, it's not really injected; it'll be ASK modulated and added using an op-amp with the power signal to the channel as a start. Injection into the powerline is the next step for the project.
I have tested the modulation and de-modulation of a random binary signals using ASK modulation through a powerline with 60Hz power running through it and I have succeeded. This is not a problem at all now. It's true that I have faced some problems injecting the message into the powerline but I have changed my plan to add it with the power line for a start, and then I will look more into the actual injection of the message.
Also, thank you for your advice about X-10.
why can't you use a tone detector on the receive side and feed it's output into the RX of a UART and similarly use a tone generator on the transmit side driven by the TX side of a UART on the chip?
If @dhary-1 can reliably see bits on both sides, why bother using a tone generator and detector?
Or is this already part of what is going on:
@dhary-1 please elaborate on your power line modulator/demodulator scheme. As suggested, if you have a power line modem, in effect, the easy thing to do is use serial comms between the Arduinos.
I don't think I need a tone detector and generator, but UART might work since my problem is receiving the binary sequence and getting back each single bit alone to determine the state of each LED.