I would add to the list nRFIoT project from hackaday.io. Author shared brd file. Arduino Pro Mini with nRFIoT is very tiny.
BTW change units to mm in the list
Posts made by lasso
-
RE: PCB Boards for MySensors
-
IR / RF 433 MHz blaster with SD card or I2C EEPROM memory
Hi,
I would like to make IR / RF 433 MHz Sensor with EEPROM / SD card memory.
Features of this sensor:- Sending out and getting codes:
- IR codes using IRLib or IRremote libraries.
I have UPC Philips PVR decoder. IR codes from remote of this decoder are not recognized by IRLib and IRremote libraries and are saved as RAW codes. These RAW codes take up much space. Problem is that IRLib and IRremote can't save long RAW codes. This problem is described in Martin's blog. Martin has edited IRremote library to get long IR signal. I managed to do the same with IRremote library and I could getting long raw codes from my remote. Code which I received I send out using IR LED and IRLib. Here is the sketch. I tried to get long RAW codes with IRLib but without success, because I can get only the first half of RAW code. The second half of the code which is copy of the first half of the code is not received. Even I tried to introduce some change in IRLib.cpp, but it does not change anything. Diff of IRLib.cpp is here. Maybe I have to make other changes in code? - RF 433 MHz codes to turn on/off sockets like this using that library. I wrote this sketch with Hek’s help. Using this sketch I can get and send out codes from/to remote to turn on/off sockets. Example of this code is: “356428203”, where 3 last digits are period of sending code.
- IR codes using IRLib or IRremote libraries.
I would like to keep RAW IR codes on the side MySensors node. I wonder if use EEPROM memory 24LC512 or micro SD card with this adapter.
24LC512 EEPROM memory VS SD card:-
Pros for 24LC512 EEPROM:
-
I2C interface
SD card uses SPI interface like NRF24L01. It may causing conflict with NRF24L01. -
Library for I2C EEPROM takes less memory than SD library
-
EEPROM is cheaper than SD card and adapter.
-
Pros for SD card:
-
Faster than EEPROM
-
Easier to use, because don’t need to implement more complex algorithm for EEPROM memory management.
-
It is possibility to easy access data from SD on PC. For example to make a backup.
-
Much more space than EEPROM (e.g. 2 GB vs 64 KB. One RAW code is about 250 bytes)
I think about communication between gateway – IR/RF node.
There will be 3 scenarios:- IR/RF node -> gateway
Received new code from IR/RF sensor
Message structure:
radioID; childID; messageType; subType; payload
IR/RF node ID; childID; Set Variable; V_IR_RECEIVE; 0 - RAW/1 - NEC/2 - Sony/3 -RC5/4 -RC6/5 - JVC/6- NECx,7 - Panasonic_old, 8 – RF433 code, Code_length, code
If type of code is RAW, sending code is hash. - Gateway -> IR/RF node
Send out IR/RF signal.
Message structure:
radioID; childID; messageType; subType; payload
IR/RF node ID, childID; Set Variable; V_IR_SEND; 0 - RAW/1 - NEC/2 - Sony/3 -RC5/4 -RC6/5 - JVC/6- NECx,7 - Panasonic_old, 8 – RF433 code, code - Gateway -> IR/RF node
Save last received RAW code to node’s memory
radioID; childID; messageType; subType; payload
IR/RF node ID, childID; Set Variable; V_IR_SAVE; 0 - Gateway -> IR/RF node
Erase specific RAW code from node’s memory
radioID; childID; messageType; subType; payload
IR/RF node ID, childID; Set Variable; V_IR_ERASE; code
Data stored on a node’s memory:
- Hash of RAW code
- Code
Data stored in Ago Control’s json database:
- nodeID
- childID
- Internal ID of virtual device, e. g.: TV Samsung, AV receiver, air conditioner…
- Code type: 0 - RAW/1 - NEC/2 - Sony/3 -RC5/4 -RC6/5 - JVC/6- NECx,7 - Panasonic_old, 8 – RF433 code
- Code(if RAW – hash of code)
In Ago Control I plan to add IR/RF plugin. Using this plugin I could:
- Adding and removing devices (e. g. TV) with push buttons
- Learn codes from getting messages
- Saving and removing RAW codes from node’s memory (Not directly but when push button with RAW code is added or removed from ago control database)
Currently I’m more inclined to use SD memory, but I doubt if SD library fits to Arduino flash memory. In addition, I wonder if there will be SPI interface conflict between SD card and NRF24L01.
What do you think about my idea?
- Sending out and getting codes:
-
RE: RF 433 MHz sensor to control RF sockets.
@hek
Wow it's working . Hek thank you very much, you are the master
This is working code:
#include <Relay.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>#include <RemoteReceiver.h> #include <RemoteTransmitter.h> #define TRANSMITTER_PIN 8 #define RECEIVER_INTERRUPT 1 #define RF433_CHILD_ID 0 Sensor gw; volatile bool receivedNew = false; volatile unsigned long incomingRfCode; volatile unsigned int incomingRfPeriod; void setup() { gw.begin(28); gw.sendSketchInfo("RF433", "1.0"); gw.sendSensorPresentation(RF433_CHILD_ID, S_IR); delay(200); RemoteReceiver::init(RECEIVER_INTERRUPT, 3, newRf); } void loop() { if (gw.messageAvailable()) { message_s message = gw.getMessage(); sendRfMessage(message); } if(receivedNew) { getRfMessage(incomingRfCode, incomingRfPeriod); receivedNew = false; } } void sendRfMessage(message_s message) { if (message.header.messageType==M_SET_VARIABLE && message.header.type==V_IR_SEND) { char sendingRfCode[7]; char sendingRfPeriod[4]; strncpy(sendingRfCode, message.data, 6); strncpy(sendingRfPeriod, message.data+6, 3); sendingRfCode[6] = 0; sendingRfPeriod[3] = 0; Serial.println(atol(sendingRfCode)); Serial.println(atol(sendingRfPeriod)); RemoteReceiver::disable(); interrupts(); delay(200); RemoteTransmitter::sendCode(TRANSMITTER_PIN, atol(sendingRfCode), atol(sendingRfPeriod), 3); RemoteReceiver::enable(); } } void newRf(unsigned long _incomingRfCode, unsigned int _incomingRfPeriod){ incomingRfCode = _incomingRfCode; incomingRfPeriod = _incomingRfPeriod; receivedNew=true; } void getRfMessage(unsigned long incomingRfCode, unsigned int incomingRfPeriod){ char gettingRfMessage[10]; sprintf(gettingRfMessage, "%lu%u", incomingRfCode, incomingRfPeriod); Serial.println(incomingRfCode); Serial.println(incomingRfPeriod); Serial.println(gettingRfMessage); gw.sendVariable(RF433_CHILD_ID, V_IR_RECEIVE, gettingRfMessage); }
-
RE: RF 433 MHz sensor to control RF sockets.
@hek
I detached IRQ pin from pin 2 in Arduino and attached to pin 2 data line from RF433 receiver. After that, I changed RECEIVER_INTERRUPT to 0. Program works in the same way. The problem has not been solved. -
RE: RF 433 MHz sensor to control RF sockets.
OK, I stopped using String Class, but program works in the same way.On start Arduino, program works well and I can get and send RF433 codes. After some pushes a button on RF433 remote, LED on Arduino (pin 13) turns off and then I can't send messages from gateway to node, but I can still get codes of buttons on gateway from node. I think that, maybe this problem is connected with interrupts because NRF24 and receiver RF433 modules are using interrupts. IRQ pin from NRF24 module is connected to pin 2 (int.0) in Arduino Pro Mini and data pin from receiver RF433 module is connected to pin 3 (int.1) in Arduino.
@hek Do You have any idea why this program doesn't work properly?#include <Relay.h> #include <SPI.h> #include <EEPROM.h> #include <RF24.h> #include <RemoteReceiver.h> #include <RemoteTransmitter.h> #define TRANSMITTER_PIN 8 #define RECEIVER_INTERRUPT 1 #define RF433_CHILD_ID 0 Sensor gw; void setup() { gw.begin(28); gw.sendSketchInfo("RF433", "1.0"); gw.sendSensorPresentation(RF433_CHILD_ID, S_IR); RemoteReceiver::init(RECEIVER_INTERRUPT, 3, getRfMessage); } void loop() { if (gw.messageAvailable()) { message_s message = gw.getMessage(); sendRfMessage(message); } } void sendRfMessage(message_s message) { if (message.header.messageType==M_SET_VARIABLE && message.header.type==V_IR_SEND) { char sendingRfCode[7]; char sendingRfPeriod[4]; strncpy(sendingRfCode, message.data, 6); strncpy(sendingRfPeriod, message.data+6, 3); sendingRfCode[6] = 0; sendingRfPeriod[3] = 0; Serial.println(atol(sendingRfCode)); Serial.println(atol(sendingRfPeriod)); RemoteReceiver::disable(); interrupts(); delay(200); RemoteTransmitter::sendCode(TRANSMITTER_PIN, atol(sendingRfCode), atol(sendingRfPeriod), 3); RemoteReceiver::enable(); } } void getRfMessage(unsigned long incomingRfCode, unsigned int incomingRfPeriod){ char gettingRfMessage[10]; sprintf(gettingRfMessage, "%lu%u", incomingRfCode, incomingRfPeriod); Serial.println(incomingRfCode); Serial.println(incomingRfPeriod); Serial.println(gettingRfMessage); gw.sendVariable(RF433_CHILD_ID, V_IR_RECEIVE, gettingRfMessage); delay(200); }
-
RE: RF 433 MHz sensor to control RF sockets.
Hek, thank for your response. I have to send two information to node (and from node): RF433 code and period. I would like to avoid sending this information in two messages (e.g. as V_VAR1 and V_VAR2), so I joined this informations in one by using class String. Maybe do You have idea how to avoid String class in this program?
-
RE: RF 433 MHz sensor to control RF sockets.
Thank You for response.
This is actual code: http://wklej.org/id/1365746/
I noticed that, the problem occurs when node receiving code from RF433 remote. After start arduino program works good (diode connected to pin 13 lights up). When I push button on RF433 remote several times diode turns off and then I can't send codes from gateway to node. When I push buttons on RF433 remote diode blinks and codes are transmitted to gateway correctly. After a few more pushes of the button on remote diode connected to pin 13 turns on and then I can't send codes to node from gateway and get codes from node to gateway. -
RE: RF 433 MHz sensor to control RF sockets.
I mean, construction of message is (string) "RF code" + "period". For example: if RF code is 123456 and period is 200, message looks like this: 123456200.
OK I fixed problem with string to integer conversion by using command toInt() . Code looks like this now:
String sendingRfMessage = String(message.data);
unsigned long sendingRfCode = sendingRfMessage.substring(0,sendingRfMessage.length()-3).toInt();
unsigned int sendingPeriod = sendingRfMessage.substring(sendingRfMessage.length()-3).toInt();Program below relays RF 433 commands from RF 433 remote to Gateway and from Gateway to RF 433 sockets.
If I send message 28;8;1;32;356428203 (RF code is 356428 and period is 203) to node from Gateway, then my socket turns on. If I push button on RF 433 remote which turns on the same socket, then I get this message: 28;2;1;33;356428203 from node on my Gateway.
This program works, but I have stability problem. If I push buttons on my RF 433 remote several times at the begging program works correctly and I get messages with codes and periods on Gateway. But after some time program stops and I can't get messages from node and send messages to node. After this I can only reset arduino
BulldogLowell, do You know why I have this problem?#include <Relay.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>#include <RemoteReceiver.h>
#include <RemoteTransmitter.h>#define PIN_TRANSMITTER 8
#define RECEIVER_CHILD_ID 2
Sensor gw;void setup()
{
gw.begin(28);
gw.sendSketchInfo("RF433", "1.0");
gw.sendSensorPresentation(PIN_TRANSMITTER, S_IR);
RemoteReceiver::init(0, 3, getRfMessage);}
void loop()
{
if (gw.messageAvailable()) {
message_s message = gw.getMessage();
sendRfMessage(message);
}
}void sendRfMessage(message_s message) {
if (message.header.messageType==M_SET_VARIABLE &&
message.header.type==V_IR_SEND) {
String sendingRfMessage = String(message.data);
unsigned long sendingRfCode = sendingRfMessage.substring(0,sendingRfMessage.length()-3).toInt();
unsigned int sendingPeriod = sendingRfMessage.substring(sendingRfMessage.length()-3).toInt();Serial.println(sendingRfCode); Serial.println(sendingPeriod); RemoteReceiver::disable(); interrupts(); RemoteTransmitter::sendCode(PIN_TRANSMITTER, sendingRfCode, sendingPeriod, 3); RemoteReceiver::enable();
}
}void getRfMessage(unsigned long incomingRfCode, unsigned int incomingPeriod){
String gettingRfMessage = String(incomingRfCode)+String(incomingPeriod);
Serial.println(gettingRfMessage.toInt());
gw.sendVariable(RECEIVER_CHILD_ID, V_IR_RECEIVE, gettingRfMessage.toInt());
} -
RF 433 MHz sensor to control RF sockets.
Hello,
I would like to make sensor to control RF 433 MHz sockets. I have connected RF433 transmitter and receiver to node. I use Ago Control as a controller of gateway. I want to get RF codes from node and store them in controller. I want to control RF sockets by sending codes from controllerNow I have created sketch to transmit code from controller to node. The message code consists of RF code and period. I would like to split this message. I have problem with convert string to integer.
This is actual code:#include <Relay.h>
#include <SPI.h>
#include <EEPROM.h>
#include <RF24.h>#include <RemoteReceiver.h>
#include <RemoteTransmitter.h>#define PIN_TRANSMITTER 8
Sensor gw;
void setup()
{
gw.begin(28);// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("RF433", "1.0");// Register all sensors to gw (they will be created as child devices)
gw.sendSensorPresentation(PIN_TRANSMITTER, S_IR);}
void loop()
{
if (gw.messageAvailable()) {
message_s message = gw.getMessage();
sendRfMessage(message);
}
}void sendRfMessage(message_s message) {
if (message.header.messageType==M_SET_VARIABLE &&
message.header.type==V_IR_SEND) {
unsigned long incomingRfCode = atoi(String(message.data).substring(0,6).c_str());
unsigned int incomingPeriod = atoi(String(message.data).substring(6).c_str());
// Change relay state
//digitalWrite(message.header.childId, incomingRfCode);
// Write some debug info
//Serial.print("Incoming change for relay on pin:");
Serial.println(String(message.data).substring(0,6));
Serial.println(message.data);
Serial.println(incomingRfCode);
Serial.println(incomingPeriod);
RemoteTransmitter::sendCode(PIN_TRANSMITTER, incomingRfCode, incomingPeriod, 3);
}
}If I send to node this message: 28;8;1;32;333333111
Node prints this:
333333
333333111
5653
111So there is problem with convert string to integer.
If I remove command c_str() like this:
unsigned long incomingRfCode = atoi(String(message.data).substring(0,6));
I can't compile code and I get this message:
_433mhz.ino: In function 'void sendRfMessage(message_s)':
_433mhz:40: error: cannot convert 'String' to 'const char*' for argument '1' to 'int atoi(const char*)'Anyone know how to convert str to int properly?
-
RE: Code for beta-testing?
Try comment this line: metric = gw.isMetricSystem();