X10 firecracker not working

I'm having issues using the firecracker library and the included example to send commands from my Uno through the firecracker. I checked that the firecracker works on a windows box, but I cant seem to get the firecracker + arduino to work. Does anyone have any advice?

Try replacing #include “wiring.h” with #include “arduino.h” like below in the X10firecracker.ccp file.

* CONNECTION: RTS -> DB9 pin 7  
*             DTR -> DB9 pin 4 
*             Gnd -> DB9 pin 5
*/

#include <avr/pgmspace.h>
#include "arduino.h"

#include "X10Firecracker.h"

// An instance of the EventFuse class
X10Firecracker X10 = X10Firecracker();

Thanks for the quick feedback should have been a bit more detailed rather than just saying "it didn't work". I found your suggestion in the forums when I couldn't get the code to compile. At this point, I have the code compiled and running, but it doesn't seem to do anything. I have Activehome Pro on my home automation computer and it does not see the commands from the firecracker. I believe the code is executing correctly as I added a couple serial writes to monitor.

Any other ideas?

I mentioned that the code I was trying to run was based on the example that’s included with the library. Here’s the actual code. Couldn’t get much more basic yet it still doesn’t seem to work.

#include <X10Firecracker.h>

void setup()
{
  X10.init( 2, 3, 0 );
}


void Test()
{
  /* activate chime */
  X10.sendCmd( hcB, 2, cmdOn );
}

void loop()
{
  delay(2000);
  Test();
  delay(8000);
}

I’m not sure what else to try other than compiling with a newer version of the software (1.0 currently though I have downloaded 1.0.3) or using different pins on the Uno. Any kind of suggestion would be better than my guesses.

Check your wiring and/or try different pins would be my suggestion

I assume that as it works from Windows that the house code is correct.

Yes, and even if it wasn't, the X10 software (ActiveHome Pro) running on my HA computer would report any X10 signal. So I am sure that it's not sending and being received. So, either the range is mediocre with the Arduino (less than 5 feet) or the signal isn't actually being sent.

I figured perhaps the wiring was backwards between pins 2 and 3, so I tried swapping them. That didn't make any difference. I was going to try changing to different pins last night, but the laptop battery died before I got the sketch uploaded. The only other thing I can think of is using a different connector and trying again. The one I'm using was salvaged from an old USB->serial mouse adapter. The correct pins were populated, so it seemed like a good quick test before building a proper connector for the final install.

USB to Serial adapter ? Where does that fit in when using the Arduino ?

My mistake, it was actually PS2 to serial. I cut the serial end off and soldered wires to the wires attached to pins 4, 5, and 7. I have a serial connector that I will use in the end, but I didn’t want to screw it up for testing and have to go back to the store for another. I’ve got plenty of these in my project box, so it looked like a good donor since it was populated for at least what I need.

12499f.jpg

After reviewing the ps/2 to serial mouse pinout on pinouts.ru, I'm wondering if I may have missed something in my continuity testing. I was sure that 4, 5, and 7 were populated, but that guide suggests that it's not needed, so it might not actually be hooked up. I'll have to check to make sure I have the right pins on the serial.

http://pinouts.ru/InputCables/MousePs2Serial_pinout.shtml

Are you feeding TTL level data to a true serial port that expects RS232 level data? If so, it's no wonder it doesn't work.

I just tested the below code with my CM17A firecracker and TM751 transceiver and it worked. I added some comments on connecting the wires between the arduino and the CM17A.

// zoomkat 1-15-13 test
// for use with x10 CM17A "Firecracker"
// and X10Firecracker library
// in X10Firecracker.cpp replace #include "wiring.h" 
// with #include "arduino.h"

#include <X10Firecracker.h>

void setup()
{
  //Serial DB9 connection: RTS - pin 7, DTR - pin 4, Gnd - pin 5
  //arduino pins: RTS > pin 2, DTR > pin 3, Gnd > Gnd
  //below, Arduino pins 2,3, and delay 1
  X10.init( 2, 3, 1 );  // origional 0 delay didn't work
}

void Test()
{
  X10.sendCmd( hcA, 1, cmdOn ); //TM751 transceiver on
  X10.sendCmd( hcA, 1, cmdDim );
  //extra commands removed fot testing
  X10.sendCmd( hcA, 1, cmdBright );
  X10.sendCmd( hcA, 1, cmdOff ); //TM751 transceiver off
}

void loop()
{
  delay(2000);
  Test();
  delay(8000);
}

I tested my original setup with swapping pins without success the other day. I checked that I had correctly wired the DB9 connecter this morning and it was correct. I'll try the increased delay in the x10.init line next to see if that helps. Just to be sure I didn't break the CM17A when moving wires around, I tested with a PC and did see a 100% successful send rate. So, hopefully this is just a quick fix as zoomkat posted.

This change is important.

  X10.init( 2, 3, 1 );  // origional 0 delay didn't work

I changed the delay to 1 as suggested and I am now getting a 100% success rate. Thanks!