Shop OBEX P1 Docs P2 Docs Learn Events
X-10 Firecracker Object — Parallax Forums

X-10 Firecracker Object

MikeSMikeS Posts: 131
edited 2012-03-18 15:14 in Propeller 1
I have a need to use the X-10 Firecracker module with the Propeller. I have it working with the Stamp in a similar fashion describe in the attached 2000 article by Al Williams.I did not find a Firecracker Object in the Object listings, does any one have one they would like to share? If not, my question(s) is what would be the steps in creating a Firecracker Object? Would each of Al's subroutines become a separate Method in the Object? Would the Data Block contain the exact same information and structure as the Data Statements in PBasic.
Thanks,
MikeS
«1

Comments

  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-26 13:13
    Okay, I'll bite. I don't have a Firecracker to work with, but I have Internet access and enough experience to find that this really isn't much of a challenge. Give the attached object a try. It has a LOONNNGGGG list of constants for the house/unit/on-off codes at the end that you can use. If you create an object called fc, for example, you could do this:
    fc.tx(fc#A1_ON)
    


    Updated file attached
    -- second update added inuse flag
    -- third update fixes glaring error in fc_out code (Why didn't anyone bust me on this?)
    -- final (hopefully) update attached -- more clean-ups and a few new useful methods (ready for ObEx after testing)
    -- see post below for latest version of my object (and demo for it)
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-26 14:40
    Sorry... just found and fixed another (silly) error. This is why I tend not to write and post code when I don't have hardware.
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-26 23:56
    I ordered a Firecracker kit from eBay, hence I decided to add a bit more to the object. Once I get the kit and can test the code myself I will move it to ObEx.
  • MikeSMikeS Posts: 131
    edited 2011-12-27 13:12
    JonnyMac,

    As you originality suggested, I spent yesterday writing an object for the Firecracker module but with no success. Last night I saw your posts and tried you FC Object and gave it a try, but had no success either.. I connected the FC back up to the STAMP and it is working fine. I tried looking at the DTR and RTS signal with my old analog scope but couldn't get the wave forms to sync properly to get a good look at them.It does appear that the STAMP DTR and RTS signals are slightly longer in time than what I observed coming from the Propeller running your program or mine.
    I appreciate your quick response and willingness to work on the Firecracker Object.

    MikeS

    BS2 program for testing firecracker module attached
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-27 13:17
    The timing is based on the spec, and easily changed -- in fact, in my final version I will allow the caller to set that in the .start method. My concern, though, is the output from the Propeller (3.3v) enough for the Firecracker? It may not be. You may need a buffer circuit, typically one would use a MAX232 type inverter (hence the parameter in the .start method).

    As I have a book project in the works and this may be interesting, I ordered a Firecracker kit. Once it arrives I will connect it and finalize the code.

    BTW, could you attach your BS2 code -- what is working on your end -- to your post above so I can look at it in the Stamp editor? With that I can write a demo for you that matches what you're doing; this might help me with testing.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-12-27 13:28
    I just ordered a Firecracker from eBay as well. I have used X10 modules since 1990 and control about 7 lights in my house.

    Recently my ActiveHome Pro 2-way PC Interface (CM15A) quit working and I reverted to a CM11A.

    I also have several RF transmitters and RR501 wireless receivers.

    I also have a TW523 module which works well with the BS2 X10 commands, but the Firecracker should be easier to use.

    This should be interesting...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2011-12-27 21:11
    Dang it guys!

    My list of projects I want to get to is already ten miles long without Jon creating another awesome object I want to play with... :)

    /me off to Ebay to grab a Firecracker...
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-12-28 06:20
    I found this link which says the Firecracker requires 5V - maybe that's why MikeS is having trouble...

    http://wiki.tinyclr.com/index.php?title=X10_Firecracker
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-28 10:28
    I thought that might be the case. I happen to have a TC4427 level-shifter handy so I'm going to use the attached circuit to connect the Propeller to the Firecracker.

    [Edit] For those with working hardware perhaps you'll give my demo a try. This uses the latest version of my Firecracker object which lets the caller set the bit timing in the .start() method. The updated object also has a method for taking the house code (alpha, "a".."p"), unit code (1..16), and command (0..3) and converting that to a 16-bit code that is ready for transmission.

    The demo program is a parser that lets you enter Firecracker command strings using a terminal. It expects the house code, unit code (for on and off), and a command string (OFF, ON, DIM, BRIGHT). To make it user friendly the parser allows the underscore character between elements. The following strings are examples that will work.

    a1on
    a_1_off
    a_bright
    p16_on

    (All commands are terminated with CR)

    The code is not case-sensitive and the parsing results are displayed by the demo. If the program thinks the command is valid it will be transmitted with the Firecracker. Please keep in mind that the demo is a work-in-progress and not heavily commented. That said, I always try to write obvious code so I don't think anyone will struggle with modifying it to suit their own needs.

    I'm still waiting on my eBay purchase so I can only test the code using LEDs. I appreciate any feedback.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-12-28 11:28
    JonnyMac wrote: »
    I thought that might be the case. I happen to have a TC4427 level-shifter handy so I'm going to use the attached circuit to connect the Propeller to the Firecracker...

    I have some BS170 FETs and found this forum thread - do you think this BS170 circuit would work in place of the TC4427?

    I also have some CD4050, CD4049 and 74LVC244A level shifter ICs.

    Thanks,
    - Ron
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-28 11:43
    It might, but I'm thinking that as the Firecracker is "liberating" power from the interface you may need to stiffen (that is, reduce the size of) the 5v side pull-up to allow that side to source more current into the Firecracker. I like the TC4427 because I can use the Propeller output to drive between ground and 18V (I use this as the interface for driving power MOSFETs). It's capable of sinking/sourcing enough current that some people actually use the chip as a half-bridge for small motors.
  • MikeSMikeS Posts: 131
    edited 2011-12-29 07:56
    I gave your demo a try this AM with a 7406 but didn't have any luck. I reduced the 7406 output pull-ups to 470 ohms to the 5V. In your demo I changed the DTR and RTS pin assignments to what I have wired (15 and 14) and changed the "inverter" option in the fc.start to TRUE. Anything else I might have missed?

    Thanks,
    MikeS
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-12-29 08:06
    I gave your demo a try this AM with a 7406 but didn't have any luck.

    A 7406 is an inverter, a TC4427 is not (it's non-inverting).
  • JonnyMacJonnyMac Posts: 8,912
    edited 2011-12-29 08:42
    Anything else I might have missed?

    I don't know; perhaps using an open-collector output is just not appropriate for the Firecracker. Mine should arrive today; once it's in hand I will validate my code and re-post if necessary.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-12-29 10:58
    Took a lot of searching but I found a schematic and other info for the CM17A at this FCC link

    EDIT: After opening up my module and examining it,
    it was obvious that this schematic must be old and does not reflect the current circuit...

    CM17A picture3.jpg
    CM17A picture2.jpg
    schematic.jpg
    593 x 398 - 33K
    573 x 402 - 32K
    372 x 535 - 26K
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2011-12-30 16:00
    I got my Firecracker today and created a BS2 program to test it out. (Haven't tried a SPIN program yet).

    The BS2 program prompts the user to "Enter 'y' for interactive mode".
    If the BS2 is not connected to the PC or if the user fails to enter a 'y', it goes into demo mode.
    Demo mode turns on lights C2 thru C6 and then turns them back off and the program ends.
    After C3 is turned on, 6 DIM commands are sent.

    Normal mode prompts once for the house code and repeatedly prompts for the unit number (1 thru 16) and the command (on, off, dim, bright).

    EDIT: Although not in the 'official' documentation, "ALL LIGHTS ON" and "ALL UNITS OFF" can be handled by the Firecracker. (see code).
    Restructured code in v3.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-03 18:36
    JonnyMac wrote: »
    I don't know; perhaps using an open-collector output is just not appropriate for the Firecracker. Mine should arrive today; once it's in hand I will validate my code and re-post if necessary.

    @Jon,
    Did you ever get your X10 units? Did it work with the TC4427 as a level shifter?

    I converted my BS2 program to SPIN and tried using the BS170 mosfets - it didn't work. I switched to 3.3k ohm resistors on the 5V side with no luck.

    I guess you are right - the BS170 circuit won't provide enough current for the Firecracker.

    I also converted my BS2 program to PICAXE basic and it works fine - of course I was using 5V with the PICAXE.
  • JonnyMacJonnyMac Posts: 8,912
    edited 2012-01-03 21:19
    I received the device but haven't had time to work with it yet. Will report ASAP.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-01-04 07:07
    I just got one in.. I'm planning to use a MAX3232 chip to handle the communication between it and the Propeller.

    Ordered the mosfet after seeing Johns circuit.

    OBC
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-05 06:00
    I just got one in.. I'm planning to use a MAX3232 chip to handle the communication between it and the Propeller.

    Ordered the mosfet after seeing Johns circuit.

    OBC

    @Jeff

    I tried using some different transistors and mosfets with no luck so I also ordered some TC4427A chips.

    Jon apparently has used them in several projects other than as mosfet drivers.
  • JonnyMacJonnyMac Posts: 8,912
    edited 2012-01-05 06:51
    I've only used the TT4427 as a MOSFET driver; that said, I've seen several applications where they're used as a half-bridge for small motors. The point is that the device can sink or source 150mA at the VCC voltage which -- I believe -- will allow it to provide enough current to charge the power supply inside the Firecracker. I'm finishing up some client code today and will try to get my Firecracker hooked up after.
  • MikeSMikeS Posts: 131
    edited 2012-01-05 08:50
    I can't believe that the Firecracker would require much current, after all it is being driven directly from a STAMP pin, approx. 20ma max, correct? I have driven lights and relays with the 7406 and it handles a lot more than 20ma. I have a hunch it is a timing issue but I don't have a decent scope to look at the two signals.
    MikeS
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-05 09:53
    MikeS wrote: »
    I can't believe that the Firecracker would require much current, after all it is being driven directly from a STAMP pin, approx. 20ma max, correct? I have driven lights and relays with the 7406 and it handles a lot more than 20ma. I have a hunch it is a timing issue but I don't have a decent scope to look at the two signals.
    MikeS

    My second attempt at using BS170 mosfets worked sometimes but the voltage drop (using 5V on the drain) was too much. Also, there was alot of variance between different BS170s - cheap parts maybe?

    Here is the SPIN code I created by converting my BS2 code (which works)...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-01-07 09:51
    I've setup Jon's circuit this morning.. haven't had much luck with it yet. A

    Anyone else get this up and running yet?

    OBC
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-07 10:06
    I've setup Jon's circuit this morning.. haven't had much luck with it yet. A

    Anyone else get this up and running yet?

    OBC

    I hope to get my TC4427A ICs today but it might be Monday.

    I suppose another way to tackle this would be to remove the PCB from the shell and bypass the diodes to feed 5V directly to the PIC and see if the inputs respond to the 3.3V signals from the Propeller...
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-01-07 10:12
    I ordered TC4427CPA (dip version) -- Issue here I didn't realize?

    OBC
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-07 10:17
    I ordered TC4427CPA (dip version) -- Issue here I didn't realize?

    OBC

    I don't think there is much of a difference -

    The TC4427A datasheet says:

    The TC4426A/TC4427A/TC4428A are improved versions of the earlier TC4426/TC4427/TC4428 family of MOSFET drivers. In addition to matched rise and fall times, the TC4426A/TC4427A/TC4428A devices have matched leading and falling edge propagation delay times.These devices are highly latch-up resistant under any conditions within their power and voltage ratings.
    They are not subject to damage when up to 5V of noise spiking (of either polarity) occurs on the ground pin.They can accept, without damage or logic upset, up to 500 mA of reverse current (of either polarity) being forced back into their outputs. All terminals are fully protected against Electrostatic Discharge (ESD) up to4 kV.The TC4426A/TC4427A/TC4428A MOSFET drivers can easily charge/discharge 1000 pF gate capacitances in under 30 ns. These devices provide low enough impedances in both the on and off states to ensure the MOSFET’s intended state will not be affected, even by large transients.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-01-07 11:13
    I've posted a photo of my breadboard circuit...

    http://www.dropbox.com/gallery/7557533/1/firecracker?h=56c054

    Maybe one of you guys will see where I'm going wrong.. Gotta be a stupid error on my part.

    Second pair of eyes anyone?

    OBC
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2012-01-07 12:28
    I've posted a photo of my breadboard circuit...

    http://www.dropbox.com/gallery/7557533/1/firecracker?h=56c054

    Maybe one of you guys will see where I'm going wrong.. Gotta be a stupid error on my part.

    Second pair of eyes anyone?

    OBC

    Jeff,
    It works great using my program and Jon's schematic.

    If your program is using P0 for DTR and P1 for RTS, you might have your yellow and blue wires on the DSUB connector reversed...

    Have you tried my code or just Jon's?

    I am feeding 5V to the IC - are you trying to use 3V?
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2012-01-07 12:59
    Yeah, I'm using 5v.

    I've reversed the DSUB connections just to see if it makes any difference. No dice.
      dtr   = 0       'DB9 pin 4 on Firecracker
      rts   = 1       'DB9 pin 7 on Firecracker
    

    OBC
Sign In or Register to comment.