Nightlight sensor with multiple wireless toggled lamps.

I need help. I want to place one nightlight sensor (using attiny) on my roof or somewhere else in yard. And to wirelessly turn on lamps all over yard. They work on 220v and some on 24v. I want to each lamp have own receiver and attiny as transmitter for on or off. Now the question. What is best way for this communicaiton. Bluetooth, WiFi, RF Links or something else?

It would probably be cheaper and simpler for each lamp to have its own sensor.

If you do want to use wireless I think the NRF24 2.4GHz transceiver module would be best - cheap and simple. Bluetooth has short range and I think devices must be paired. WiFi is more complex as it requires a client-server system. Several NRF24s can listen to the same transmission.

...R

Agree with the above.

You want the nrf chips. One signal that all can pick up. You can encode some "address" bits in to your signal, much like I2C to address individual lamps if you wished (say turn on the front ones before the back ones depending on the light value).

https://www.hackster.io/arjun/nrf24l01-with-attiny85-3-pins

Thanks. I totally forgot on nrf24l01.

Your biggest problem will be range. Check the range on the modules and consider making aerials for them.

Here is the usual library for the modules.

If you want to try and make the lights independent, encode each with a byte variable that they can check when a signal is sent out.

1.Transmitter sends a "start" byte of data.
2. Receivers pick data up data and wait for next byte.
Transmitter sends a "ID" byte...one different for each rx device.
3. If the next byte matches their byte, they send an ACK byte (can be the same as the RX units byte) so the transmitter knows one is listening.
4.Transmitter sends the instruction byte....turn on/off/half/blink/ etc.
5. RX device sends ACK again to say it got the instruction.
6. Transmitter sends a kill byte to say it has finished sending instructions.
7. RX sends final ACK byte to acknowledge it knows it has the last instruction.

Repeat.

Johnny010:
Your biggest problem will be range. Check the range on the modules and consider making aerials for them.

Here is the usual library for the modules.
GitHub - maniacbug/RF24: Arduino driver for nRF24L01

If you want to try and make the lights independent, encode each with a byte variable that they can check when a signal is sent out.

1.Transmitter sends a "start" byte of data.
2. Receivers pick data up data and wait for next byte.
Transmitter sends a "ID" byte...one different for each rx device.
3. If the next byte matches their byte, they send an ACK byte (can be the same as the RX units byte) so the transmitter knows one is listening.
4.Transmitter sends the instruction byte....turn on/off/half/blink/ etc.
5. RX device sends ACK again to say it got the instruction.
6. Transmitter sends a kill byte to say it has finished sending instructions.
7. RX sends final ACK byte to acknowledge it knows it has the last instruction.

Repeat.

Yeah. It sounds easy and it is easy. Can you give me an example of code because i dont have idea how to program this. I thinked about it but in diffrent way. I wanted to send lamp1on and all recive that serial text. If it matches with commands on receiver then do it.

NickyYTSRB:
Can you give me an example of code because i dont have idea how to program this.

Oooh. This will be a really tough project for you in that case. But I think the RF library should have examples that include sending and receiving bytes.

NickyYTSRB:
Yeah. It sounds easy and it is easy. Can you give me an example of code because i dont have idea how to program this. I thinked about it but in diffrent way. I wanted to send lamp1on and all recive that serial text. If it matches with commands on receiver then do it.

You will also want lampoff I assume...but a byte of just 0b00000001 would suffice for on and 0b00000000 for off, and with an instruction of only 8 bits long as opposed to lampon(6 bytes = 48bits) there is much less chance of a noisy or bad byte wrecking the thing.

Use the examples provided in that library. As far as installing the library:https://www.arduino.cc/en/Guide/Libraries

Then in your Arduino environment, go to File -> Examples -> RF24 and have a look at the sketches in there to give you an idea of how the library works!

Rather than waste time sending "lamp1on" etc I suggest that you assign a letter of the alphabet to each lamp (assuming you have 26 or fewer) and then send (eg) 'A' for lamp-on and 'a' for lamp-off.

Better still send "" and "" where the <> mark the beginning and end of the message

This system would also allow you to send (eg) "" to switch some on and some off.

...R