Properties

  • Dimensions 75mm x 32mm
  • The Nordic nRF24L01+ 2.4 GHz Radio transceiver on board
  • Supply voltage 100-240VAC 50-60Hz by HLK-PM01
  • Atmega328P the CPU of Arduino
  • ATSHA204A for signing messages
  • ACS712-5A lighting current measurement (not mounted on the PCB when bought)
  • BTS137S Triac to switch lights with zero crossing detection (no dimming)
  • MOC3043 opto-coupler for separation between mains and low voltage
  • M25P40 Serial Flash Embedded Memory

Wiring

Screenshot_20171007_205742.png

Schematics

Schematics (pdf)

The NRF is connected to the Atmega in the standard MySensors way (as defined at https://www.mysensors.org/build/connect_radio).

The SMD button mounted on the PCB is connected to Atmega digital pin 6.

The triac for the lights is connected to Atmega digital pin 4.

The external switch connected with wires is connected to Atmega digital pin 3:

#define RELAY_PIN  4  // Arduino Digital I/O pin number for relay
#define BUTTON_PIN 3  // Arduino Digital I/O pin number for button

The "Lamp" LED is connected to pin 15(A1):

#define LAMP_LED_PIN 15 // A1

The "Debug" LED (green) is connected to pin 14(A0):

#define DEBUG_LED_PIN 14 // A0

The ATSHA204A pin SDA is connected to the A2 pin (unlike e.g. the SenseBender, where it is A3):

#define ATSHA204_PIN 16 // A2

Datasheets

Programming

In Arduino IDE you must select "Arduino/Genuino UNO" board. Baudrate is 115200.

Name Location How to use
+3.3V top, 1st from left connect to TTL UART +3.3V
RST top 2nd from left connect to TTL UART DTR via a 100nF capacitor
GND top 3rd from left connect to TTL UART GND
SCK top 4th from left  
MISO bottom, opposite SCK  
MOSI bottom, opposite GND  
TxD bottom, opposite RST connect to TTL UART RxD
RxD bottom, opposite +3.3V connect to TTL UART TxD

The programmer PCB shows the functions of the pins:

PCB-top.svg

Beware, the above layout lacks the capacitor 100nF as shown below:

Programming.jpg

Testing Code

See Lighting.ino. This sketch is based on the MySensors RelayWithButtonActuator.

First sign of life

0 MCO:BGN:INIT REPEATER,CP=RNNRA--,VER=2.1.1
3 TSM:INIT
4 TSF:WUR:MS=0
11 TSM:INIT:TSP OK
13 TSM:FPAR
15 TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
867 TSF:MSG:READ,0-0-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
872 TSF:MSG:FPAR OK,ID=0,D=1
902 TSF:MSG:READ,0-7-255,s=255,c=3,t=8,pt=1,l=1,sg=0:0
1072 TSF:MSG:READ,7-7-255,s=255,c=3,t=8,pt=1,l=1,sg=0:1
2023 TSM:FPAR:OK
2024 TSM:ID
2025 TSM:ID:REQ
2028 TSF:MSG:SEND,255-255-0-0,s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
2181 TSF:MSG:READ,0-0-255,s=255,c=3,t=4,pt=0,l=2,sg=0:10
2186 TSF:SID:OK,ID=10
2188 TSM:ID:OK
2190 TSM:UPL
2216 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
2223 TSF:MSG:READ,0-7-255,s=255,c=3,t=4,pt=0,l=2,sg=0:10
2229 TSF:MSG:BC
2231 TSF:MSG:READ,0-0-10,s=255,c=3,t=25,pt=1,l=1,sg=0:1
2236 TSF:MSG:PONG RECV,HP=1
2238 TSM:UPL:OK
2240 TSM:READY:ID=10,PAR=0,DIS=1
2244 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
2253 TSF:MSG:READ,0-0-10,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
2263 TSF:MSG:SEND,10-10-0-0,s=255,c=0,t=18,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
2274 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
3181 TSF:MSG:READ,0-0-10,s=255,c=3,t=6,pt=0,l=1,sg=0:M
3188 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=11,pt=0,l=8,sg=0,ft=0,st=OK:Lighting
3198 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:2.0
3208 TSF:MSG:SEND,10-10-0-0,s=1,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=OK:
3213 MCO:REG:REQ
3217 TSF:MSG:SEND,10-10-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
3223 TSF:MSG:READ,0-0-10,s=255,c=3,t=27,pt=1,l=1,sg=0:1
3228 MCO:PIM:NODE REG=1
3231 MCO:BGN:STP
3232 MCO:BGN:INIT OK,TSP=1
Comments: