Building an IR Blaster
-
@BulldogLowell Ummm... How do I print gw.getStatus to Serial? :confused:
for an integer:
if (message.header.type==V_VAR1) { int yourNumber = atoi(message.data); Serial.println(yourNumber); }For a string:
if (message.header.type==V_VAR1) { String yourText = String(message.data); Serial.println(yourText); } -
for an integer:
if (message.header.type==V_VAR1) { int yourNumber = atoi(message.data); Serial.println(yourNumber); }For a string:
if (message.header.type==V_VAR1) { String yourText = String(message.data); Serial.println(yourText); }@BulldogLowell Got it. Thanks!
-
Nothing... It must have to do with the MySensors plugin not relaying the message back to the Arduino. This is probably because Hek was not done with the IR part of MySensors. As you have seen from previous posts, I changed the Lua file, but something else probably needed to be changed in order to send the IR code back to Vera. BTW - Code I used: (I used both RECEIVE and SEND because I didn't know which was from Vera to Arduino.)
void loop() {
message_s message = gw.getMessage();
if (message.header.type==V_IR_RECEIVE) {
String yourText1 = String(message.data);
Serial.println(yourText1);
if (message.header.type==V_IR_SEND) {
String yourText2 = String(message.data);
Serial.println(yourText2);
}
}
}Thanks everyone for the support with the IR project!! :smile: :clap: I think someone just needs to fiddle with the code some more.
-
@steets250 said:
someone
you? ;-)
Do you get anything back froom the plugin like "no implementation" or similar?
Any clues in the <verip>/cgi-bin/cmh/log.sh?Device=LuaUPnP log? -
Unfortunately, I don't know Luup, the only change that I made to the .lua file was to change a file name.
The log gives me this when I send out an IR code:
08 06/05/14 22:04:32.359 JobHandler_LuaUPnP::HandleActionRequest argument ProntoCode=0000 0068 0000 000D 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 03EC <0x2d18b680>
02 06/05/14 22:04:32.359 Device_LuaUPnP::HandleActionRequest 55 none of the 1 implementations handled it <0x2d18b680>
01 06/05/14 22:04:32.809 ZZZ-A2 2 <0x2d18b680>
01 06/05/14 22:04:32.809 ZZZ-1 2 <0x2d18b680>
01 06/05/14 22:04:32.809 ZZZ-1b 0xb52db8 <0x2d18b680>
08 06/05/14 22:04:32.810 JobHandler_LuaUPnP::HandleActionRequest device: 55 service: urn:micasaverde-com:serviceId:IrTransmitter1 action: SendProntoCode <0x2d18b680>I want to see 0x2d18b680 come up on the serial, but I get nothing. I did also test to make sure that the Arduino was sending out serial messages.
If any one want to give it a try, replace the existing file with the one below (one one small change, nothing else is affected), and then use the code I posted previously. After the IR device is added to Vera, go to Devices, Add Device, IR Device, Ok, Select the IR Transmitter, and Choose Guided Setup. Then pick a random brand and try a code.
I will sign off for now. Let me know if you get anything!
-
maybe tomorrow I can mess with it
thanks
-
@steets250 said:
I think you have to create your own implementation of SendProntoCode.
You must take care of and handle all actions in D_IrTransmitter1.xml. Edit the I_Arduino.xml where you will find the actions defined.
<action> <serviceId>urn:micasaverde-com:serviceId:IrTransmitter1</serviceId> <name>SendProntoCode</name> <run>if (p ~= nil) then p.sendProntoCode(lul_device, lul_settings.ProntoCode) end</run> </action>And then implement sendProntoCode in L_Arduino.lua which sends the actual code using sendCommand to gateway for further processing.
function sendProntoCode(device, prontoCode) sendCommand(luup.devices[device].id,"IR_SEND",prontoCode) endBut as I said in an earlier post the normal ProntoCode is too large to fit in one message over the air. So either you have to send short codes or split them somehow.
ProntoCode=0000 0068 0000 000D 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 03EC -
@steets250 said:
I think you have to create your own implementation of SendProntoCode.
You must take care of and handle all actions in D_IrTransmitter1.xml. Edit the I_Arduino.xml where you will find the actions defined.
<action> <serviceId>urn:micasaverde-com:serviceId:IrTransmitter1</serviceId> <name>SendProntoCode</name> <run>if (p ~= nil) then p.sendProntoCode(lul_device, lul_settings.ProntoCode) end</run> </action>And then implement sendProntoCode in L_Arduino.lua which sends the actual code using sendCommand to gateway for further processing.
function sendProntoCode(device, prontoCode) sendCommand(luup.devices[device].id,"IR_SEND",prontoCode) endBut as I said in an earlier post the normal ProntoCode is too large to fit in one message over the air. So either you have to send short codes or split them somehow.
ProntoCode=0000 0068 0000 000D 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 03EC@hek said:
But as I said in an earlier post the normal ProntoCode is too large to fit in one message over the air. So either you have to send short codes or split them somehow.
ProntoCode=0000 0068 0000 000D 0060 0018 0018 0018 0030 0018 0030 0018 0030 0018 0018 0018 0030 0018 0018 0018 0030 0018 0018 0018 0018 0018 0018 0018 0018 03ECYes, but I think creating a state machine on the Arduino and storing these long pronto chains in flash may work.
If we can get it to send a single CHAR, that will allow is almost the entire ASCII set (minus the not useable) nearly 250 commands.
-
Hek - Thanks for the advice with the sendProntoCode! I will work on it today.
Bulldoglowell and Hek - I was just testing to see if the code would go through. I plan to have the Vera send out a number that represents a larger code stored in the Arduino.
-
I changed the files, and am now testing it out. Log says:
08 06/06/14 10:25:29.361 JobHandler_LuaUPnP::HandleActionRequest argument ProntoCode=0000 0071 0000 001A 0080 0080 0020 0020 0020 0020 0020 0020 0020 0060 0020 0020 0020 0060 0020 0020 0020 0020 0020 0020 0020 0020 0020 0020 0020 0060 0020 0060 0020 0060 0020 0060 0020 0020 0020 0060 0020 0020 0020 0060 0020 0060 0020 0060 0020 0060 0020 0060 0020 0020 0020 04DF <0x2ca29680>
02 06/06/14 10:25:29.362 Device_LuaUPnP::HandleActionRequest 38 none of the 1 implementations handled it <0x2ca29680>
01 06/06/14 10:25:29.551 ZZZ-A2 83 <0x2ca29680>
01 06/06/14 10:25:29.551 ZZZ-1 83 <0x2ca29680>
01 06/06/14 10:25:29.551 ZZZ-1b 0xe1b888 <0x2ca29680>
08 06/06/14 10:25:29.552 JobHandler_LuaUPnP::HandleActionRequest device: 38 service: urn:micasaverde-com:serviceId:IrTransmitter1 action: SendProntoCode <0x2ca29680>Last line looks promising. I guess I will try a shorter code, and see what I get.
-
Still nothing... I changed the some of the TV's IR codes (channel number buttons 1-6) to single digit numbers so that it would not be too big for serial. I case anyone wants to give it a shot, I attached the modified files.
I_Codeset_2.xml
D_Codeset_2.xml
I_Arduino1.xml
L_Arduino.lua
S_IR_Serial.ino -
Not sure if it matters but shouldn't deviceType be "urn:schemas-micasaverde-com:device:IrDevice:1" ?
IR = {20, "urn:schemas-micasaverde-com:device:IrDevice:1", "D_IrTransmitter1.xml", "IR "},And what is the difference between "D_IrDevice1.xml" and "D_IrTransmitter1.xml"? (source: http://wiki.micasaverde.com/index.php/Luup_UPNP_Files)
-
If you create a IR device as a "child" to Arduino you must handle all implementation yourself (like we just did for sendprotocode in the Arduino plugin).
I would suggest you create a thread or PM guessed on the micsa-forum who has good experience with the IR-device and is a really nice chap.
-
IMPORTANT: After forum data loss deleting half of this topic I recreated a newer and updated topic intro. If you haven't read this topic before, I recommend starting here: http://forum.mysensors.org/topic/146/building-an-ir-blaster/50
After discovering that I could create an IR device using MySensors, I wondered if I would use this as a substitute to SQ Blaster, iTACH, or USB-UIRT.
I tossed together an Arduino Nano, the NRF24L01, and an IR LED. I then created a simple program based to see what I could do with the IR device, and if I could get the Vera to use the Arduino as an IR transmitter.
Here is the program: I got rid of the # because it made the text a weird size in the forum.
include <Sensor.h>
include <SPI.h>
include <EEPROM.h>
include <RF24.h>define ID 1
Sensor gw;void setup()
{
gw.begin();
gw.sendSensorPresentation(ID, S_IR);
}void loop()
{
delay(10000); // Wait 10 seconds
}After adding the Arduino to the gateway, I encountered a problem. As soon as I add the IR device to Vera, the whole MySensors plugin glitches out, preventing all of my sensors from working. The first picture shows what the IR device looks like right after I add it, and then 20 seconds later, the second picture shows what happens until I delete the IR device from Vera.


Does anybody know what I am doing wrong? Thanks for your help!!
Steven
@steets250 Hi there
I did not notice this interesting topic til today.This might help:
http://blog.univers-domotique.com/2013/10/plugin-vera-arduir/
Give it a google translate ;-)
-
@Dvbit said:
http://blog.univers-domotique.com/2013/10/plugin-vera-arduir/
Thanks for the suggestion, however, the project talked about is going the wrong way. I want signals from Vera to the transmitter, not transmitter to Vera.
I got an IR receiver and programmed my codes into an Arduino program. For anyone wondering, I had no storage issues (previously talked about).I haven't given up on this yet (saving $200 is a pretty good motivation)! Still trying to find out how to get Vera to send a message to Vera with Vera's IR remote UI. Seeing as how I have been trying with absolutely no luck for the past few days, I might have to make me own remote UI.
I haven't contacted guessed yet but I will soon, still playing around with it myself.
Has anyone tried this yet?? Instructions above.
-
@Dvbit I didn't see anything talking about a bidirectional signal. Where did you see that? I am going to check out what it says as well as the plugin files to see what I can find.
FWI: The IR receiver I ordered from RadioShack came, so I am able to program in the codes. It was mentioned earlier that the codes would take up a lot of space on the Arduino, but using the IRRemote library, receiving a remote signal gives me a hex that will work with some of my devices, so I don't see a storage issue. I have to remotes set up so far.
-
@Dvbit I didn't see anything talking about a bidirectional signal. Where did you see that? I am going to check out what it says as well as the plugin files to see what I can find.
FWI: The IR receiver I ordered from RadioShack came, so I am able to program in the codes. It was mentioned earlier that the codes would take up a lot of space on the Arduino, but using the IRRemote library, receiving a remote signal gives me a hex that will work with some of my devices, so I don't see a storage issue. I have to remotes set up so far.
If you need space, you could always attach external memory (SD card perhaps) .
Compressing the codes would be nice.
Cannot wait until you have this worked out!
