Hi @all,
I 'm stuck here with mysensors.
I have no free USB-Port, so I decided to connect the NRF24l01+ to the the Raspi2 and fallow this HowTo. I build a LightSensor and can see the values on /dev/ttyMySensorsGateway but they are not transferred to pimatic. I noticed a high CPU-load, when the service is started.
Did some one tries to to connect the NRF24l01 Raspi2?
Maybe some one see any issue in my config?
root@raspberrypi:~# sudo /usr/local/sbin/PiGatewaySerial
Starting PiGatewaySerial...
Protocol version - 1.4
Created PTY '/dev/pts/0'
Gateway tty: /dev/ttyMySensorsGateway
================ SPI Configuration ================
CSN Pin = CE0 (PI Hardware Driven)
CE Pin = Custom GPIO25
Clock Speed = 8 Mhz
================ NRF Configuration ================
STATUS = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1 = 0xa8a8e1fc0f 0xa8a8e1fc00
RX_ADDR_P2-5 = 0xff 0xc4 0xc5 0x52
TX_ADDR = 0xa8a8e1fc0f
RX_PW_P0-6 = 0x20 0x20 0x20 0x00 0x3f 0x00
EN_AA = 0x3b
EN_RXADDR = 0x16
RF_CH = 0x4c
RF_SETUP = 0x33
CONFIG = 0x0e
DYNPD/FEATURE = 0x3f 0x06
Data Rate = 250KBPS
Model = nRF24L01+
CRC Length = 16 bits
PA Power = PA_LOW
read: 15-15-0 s=3,c=1,t=23,pt=2,l=2:66
read: 15-15-0 s=3,c=1,t=23,pt=2,l=2:63
----------------------------------------------------------------
sensor started, id 15
send: 15-15-255-0 s=255,c=0,t=17,pt=0,l=5,st=fail:1.4.2
send: 15-15-255-0 s=255,c=3,t=6,pt=1,l=1,st=fail:255
send: 15-15-255-0 s=255,c=3,t=11,pt=0,l=12,st=fail:Light Sensor
send: 15-15-255-0 s=255,c=3,t=12,pt=0,l=3,st=fail:1.0
send: 15-15-255-0 s=3,c=0,t=16,pt=0,l=0,st=fail:
92
send: 15-15-255-0 s=3,c=1,t=23,pt=2,l=2,st=fail:92
94
send: 15-15-255-0 s=3,c=1,t=23,pt=2,l=2,st=fail:94
send: 15-15-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:
92
send: 15-15-255-0 s=3,c=1,t=23,pt=2,l=2,st=fail:92
92
----------------------------------------------------------------
sudo cat /dev/ttyMySensorsGateway
15;255;0;0;17;1.4.2
15;255;3;0;6;255
15;255;3;0;11;Light Sensor
15;255;3;0;12;1.0
15;3;0;0;16;
15;3;1;0;23;92
15;3;1;0;23;94
15;3;1;0;23;92
Pimatic config
{
"plugin": "mysensors",
"driver": "serialport",
"protocols": "1.4.2",
"driverOptions": {
"serialDevice": "/dev/ttyMySensorsGateway",
"baudrate": 115200
}
},
"devices": [
{
"id": "Light",
"name": "Light",
"class": "MySensorsLight",
"nodeid": 15,
"batterySensor": false,
"sensorid": 3
},
--------------------------------
22:10:38info [pimatic-mysensors]: MySensorsLight Light Light
22:10:37info [pimatic-mysensors]: Connected to MySensors Gateway.
#include <SPI.h>
#include <MySensor.h>
#define CHILD_ID_LIGHT 3
#define LIGHT_SENSOR_ANALOG_PIN 0
unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
MySensor gw;
MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
int lastLightLevel;
void setup()
{
gw.begin(NULL,15);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Light Sensor", "1.0");
// Register all sensors to gateway (they will be created as child devices)
gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
}
void loop()
{
int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;
Serial.println(lightLevel);
if (lightLevel != lastLightLevel) {
gw.send(msg.set(lightLevel));
lastLightLevel = lightLevel;
}
gw.sleep(SLEEP_TIME);
}