X-10
Archiver
Posts: 46,084
Does anyone know the Baud rate, bits/character and parity of the BasicStamp
to X-10 controller?
Thank you.
to X-10 controller?
Thank you.
Comments
He developed a sample application, sort an XIN command. Appliaction called:
Command Expander. See LOSA
Message-ID: <38FF604C.2A2BA9BD@v...>
At 06:28 AM 4/21/00 -0400, you wrote:
>
> Would like to receive (not send) X-10 codes using a BS2 connected to a TW523.
> Any suggestions? Bill
(I guess that's my first problem!)
If I use an X-10 power line interface, I can get a nice clean version of all
the X-10 data being transmitted in my house. The X-10 data stream is a
unique, slow one - sending bit pairs (0,1=0; 1,0=1) at 60Hz. The first four
bits address contain a start code and are not in pairs. If I can capture
that with a Stamp, some really neat things become possible. For example,
lamp dimming commands can be made to pan a camera left and right,
etc...etc...
I have a couple of ideas that would use a fair amount of extra hardware, so
before moviing ahead, I thought I might ask if anyone has ever done anything
like this before?
pretty sure I saw a couple of examples of that on L.O.S.A.. I might
have the sample code too, if that's what you need.
Kevin
"Chris Loiacono (E-mail)" wrote:
>
> I also read the comment about x-10 earlier this week, and got another idea.
> (I guess that's my first problem!)
> If I use an X-10 power line interface, I can get a nice clean version of all
> the X-10 data being transmitted in my house. The X-10 data stream is a
> unique, slow one - sending bit pairs (0,1=0; 1,0=1) at 60Hz. The first four
> bits address contain a start code and are not in pairs. If I can capture
> that with a Stamp, some really neat things become possible. For example,
> lamp dimming commands can be made to pan a camera left and right,
> etc...etc...
> I have a couple of ideas that would use a fair amount of extra hardware, so
> before moviing ahead, I thought I might ask if anyone has ever done anything
> like this before?
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Thanks for responding.
Chris
>
Original Message
> From: Kevin Olalde [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=aQfFw0ddh9e3-VYS8Gc8BdU69aarfRzN92y19K-acHsoAvxdIdbI6Ixe0rRWVB3WlOetXmGfCjE]kolalde@h...[/url
> Sent: Thursday, March 01, 2001 8:59 PM
> To: basicstamps@yahoogroups.com
> Subject: Re: [noparse][[/noparse]basicstamps] X-10
>
>
> Are you just looking for code that reads the traffic from a
> TW523? I'm
> pretty sure I saw a couple of examples of that on L.O.S.A.. I might
> have the sample code too, if that's what you need.
>
Original Message
From: "Kevin Olalde" <kolalde@h...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, March 01, 2001 5:58 PM
Subject: Re: [noparse][[/noparse]basicstamps] X-10
> Are you just looking for code that reads the traffic from a TW523? I'm
> pretty sure I saw a couple of examples of that on L.O.S.A.. I might
current list is located, but I'm sure someone on this list can!
Eric
Original Message
From: arlen fletcher [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=bEBw96K9JNuER0pLyk0MnBhh0mYoXgXGc07uHbKyUTokfd0yn-S6DU14ulvRG-mCu-7KqvA6IjbgUO6dEIRK]arlen.fletcher@a...[/url
Sent: Thursday, March 01, 2001 8:35 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] X-10
What's L.O.S.A?
Original Message
From: "Kevin Olalde" <kolalde@h...>
To: <basicstamps@yahoogroups.com>
Sent: Thursday, March 01, 2001 5:58 PM
Subject: Re: [noparse][[/noparse]basicstamps] X-10
> Are you just looking for code that reads the traffic from a TW523? I'm
> pretty sure I saw a couple of examples of that on L.O.S.A.. I might
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
List of Stamp Applications
> What's L.O.S.A?
> > Are you just looking for code that reads the traffic from a TW523? I'm
> > pretty sure I saw a couple of examples of that on L.O.S.A.. I might
Kevin
"Chris Loiacono (E-mail)" wrote:
>
> Yes. I'll search the Ap List before asking for more help.
> Thanks for responding.
> Chris
>
> >
Original Message
> > From: Kevin Olalde [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=o755aN05LdM6pWhGsRKVgBE82D7JsLj8mZ48bVc8lMOxX3uRt7bbX49BwrqaHOz8nFkVFSzcXcsjRqE]kolalde@h...[/url
> > Sent: Thursday, March 01, 2001 8:59 PM
> > To: basicstamps@yahoogroups.com
> > Subject: Re: [noparse][[/noparse]basicstamps] X-10
> >
> >
> > Are you just looking for code that reads the traffic from a
> > TW523? I'm
> > pretty sure I saw a couple of examples of that on L.O.S.A.. I might
> > have the sample code too, if that's what you need.
> >
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
http://www.hth.com/filelibrary/txtfiles/losa.txt
>L.O.S.A. Stands for List Of Stamp Applications. I can't tell you where the
>current list is located, but I'm sure someone on this list can!
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
im trying to send data wireless, but somehow i have 1-bs2 and 1-bs2sx but
they dont communicate??
any suggestion what is the problem???
Also one of my BS2, when i tried to to download a program is says that can
not find com1, and that it needs power supply??
But it works with others bs2??
so anybody knows what is the problem?
and if so, how can i fix it??
thank you.
>From: Kevin Olalde <kolalde@h...>
>Reply-To: basicstamps@yahoogroups.com
>To: basicstamps@yahoogroups.com
>Subject: Re: [noparse][[/noparse]basicstamps] X-10
>Date: Thu, 01 Mar 2001 22:55:40 -0500
>
>I didn't write this, but here's the code that was sent to me.
>
>Kevin
>
>
>
>"Chris Loiacono (E-mail)" wrote:
> >
> > Yes. I'll search the Ap List before asking for more help.
> > Thanks for responding.
> > Chris
> >
> > >
Original Message
> > > From: Kevin Olalde [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=Z5AOirMg34L6CXlMI01WX0cfp80jYU-27qzlK022tfYYAiDMtD68l9Cb18dijkeV55ynDDFDpUo]kolalde@h...[/url
> > > Sent: Thursday, March 01, 2001 8:59 PM
> > > To: basicstamps@yahoogroups.com
> > > Subject: Re: [noparse][[/noparse]basicstamps] X-10
> > >
> > >
> > > Are you just looking for code that reads the traffic from a
> > > TW523? I'm
> > > pretty sure I saw a couple of examples of that on L.O.S.A.. I might
> > > have the sample code too, if that's what you need.
> > >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
>http://docs.yahoo.com/info/terms/
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>'
>'Allocate storage and define inputs.
>
>ClockIn var in7 'the clock from the TW523 is on P0
>DataIn var in5 'the data from the TW523 is on P2
>
>ClockInPin con 7
>DataOutPin con 6 'the data to the TW523 is on P1
>
>CmdHouse var nib 'holds the command's house code (4 bits)
>CmdData var byte 'holds the command's data (5 bits)
>
>BitNum var byte 'counts the bits
>LastClock var bit 'holds the last-seen clock state
>LastData var nib 'holds the last 4 data pulses
>BitOK var bit 'flag to indicate good/bad bit
>LastBit var bit 'holds last data bit read
>Night var bit '1 for night, 0 for day
>
>LastUnit var nib 'holds the unit from the last command
>
>
>'
>'Define some constants for the X10 codes.
>'NOTE: These are the values used after the translation performed
>'by the input routine. These are not the values used in the
>'raw X10 commands on the power line, but they match the values
>'used by the Stamp's XOUT command.
>
>house_a con 0
>house_b con 1
>house_c con 2
>house_d con 3
>house_e con 4
>house_f con 5
>house_g con 6
>house_h con 7
>house_i con 8
>house_j con 9
>house_k con 10
>house_l con 11
>house_m con 12
>house_n con 13
>house_o con 14
>house_p con 15
>
>unit_1 con 0
>unit_2 con 1
>unit_3 con 2
>unit_4 con 3
>unit_5 con 4
>unit_6 con 5
>unit_7 con 6
>unit_8 con 7
>unit_9 con 8
>unit_10 con 9
>unit_11 con 10
>unit_12 con 11
>unit_13 con 12
>unit_14 con 13
>unit_15 con 14
>unit_16 con 15
>
>
>'
>'Define some constants for my own house. These will have to
>'be changed if the setup changes or if the program is to be
>'used in a different house.
>
>'The receivers (switches, lamp modules, etc.) are on house code G.
>
>LivingRoomLamp con unit_2 'lamp module in the living room
>DiningRoomSwitch con unit_3 'wall switch in the dining room
>BedroomSwitch con unit_4 'wall switch in the master bedroom
>FamilyRoomSwitch con unit_5 'wall switch in the family room
>
>'The transmitters (PalmPad, motion, dusk, etc.) are on house code H.
>
>FamilyRoomMotion con unit_5 'on/off commands from family room motion sensor
>FamilyRoomDusk con unit_6 'on/off commands from family room dusk sensor
>PatioMotion con unit_7 'on/off commands from patio motion sensor
>PatioDusk con unit_8 'on/off commands from patio dusk sensor
>
>'
>'Initialize the contents of LastClock to match the current
>'state of the clock input. This is not really critical, and
>'in fact the input may change as soon as we read it, but this
>'will work OK and I dislike using uninitialized data.
>
>LastClock = ClockIn
>
>'Initialize the last unit number.
>
>LastUnit = 0
>
>'Assume it's day.
>
>Night = 0
>
>
>'
>'Top of main loop.
>'
>'Monitor the data input until we see the magic DATA START
>'signal.
>'NOTE: These are not data bits, but individual data
>'pulses (1/2 bits). In fact, the start pattern is not valid
>'data, so we cannot use the GetBit subroutine to watch
>'for it.
>'The start data pattern consists of the pulses 0001. (The
>'manuals say 1110, but our input is inverted.) The GetPulse
>'subroutine saves the last four data pulses in LastData.
>'Get each pulse and then check the pattern to see if it
>'matches.
>
>WaitForStart:
>
>gosub GetPulse
> 'debug "got pulse, it was: ", DEC LastData, cr
>if LastData <> %0001 then WaitForStart
>
> 'debug "got a start signal", cr
>'We have received the DATA START signal. Get the following
>'data.
>
>'Get the housecode. The low-order bit is received first.
>
>CmdHouse = 0
>for BitNum = 0 to 3
> gosub GetBit
> if BitOK = 0 then WaitForStart 'bad data -- bail out
> CmdHouse = CmdHouse | (LastBit << BitNum)
>next
>
>'Get the command data. The low-order bit is received first
>
>CmdData = 0
>for BitNum = 0 to 4
> gosub GetBit
> if BitOK = 0 then WaitForStart 'bad data -- bail out
> CmdData = CmdData | (LastBit << BitNum)
>next
>
>'The data we have received is in the format used by X10.
>'The bit patterns for house and unit numbers are not in
>'sequence. However, the XOUT command used by the Stamp
>'interpreter does a translation, and it uses bit patterns
>'that are in sequence. (If the Stamp had an XIN command,
>'it would probably translate the bit patterns to match
>'the XOUT command.)
>'
>'For compatibility, we'll translate
>'the house and unit numbers to match the XOUT command.
>'After the translation, house A is 0, house B is 1, etc.
>'After the translation, unit 1 is 0, unit 2 is 1, etc.
>'
>'The XOUT command (apparently) understands only six
>'command codes, and the bit patterns are not the same
>'as the raw X10 codes. We'll translate the commands
>'to the XOUT format, and we'll translate unknown commands
>'to %11111 so they can be filtered out.
>'NOTE: A possible variation is to translate the other
>'commands to unique bit patterns so they can be expanded
>'using commands the Stamp can send.
>
>temp var byte
>
>lookup CmdHouse,[noparse][[/noparse]12,13,14,15,2,3,0,1,4,5,6,7,10,11,8,9],temp
>CmdHouse = temp
>
>if CmdData.bit4 = 1 then TranslateAction
>
>lookup CmdData,[noparse][[/noparse]12,13,14,15,2,3,0,1,4,5,6,7,10,11,8,9],temp
>CmdData = temp
>goto EndTranslate
>
>TranslateAction:
>CmdData.bit4 = 0 'clear the top bit to make index from 0 to 15
>lookup
>CmdData,[noparse][[/noparse]unitsOff,31,dim,31,unitOn,31,31,31,lightsOn,31,bright,31,unitOff,31,31\
,31],temp
>CmdData = temp
>
>EndTranslate:
>
>
>'
>'We have received an X10 command. Do something with it.
>'
>'This code is used for the following setup:
>'
>'All transmitters are set to house code H.
>'All receivers (switches, modules, etc.) are set to
>'house code G.
>'This code performs some translations of the received
>'commands, and may send commands to the receivers.
>
>'See if the command was for the house we're using.
>'If not, just go wait for another command.
>
>'if CmdHouse <> house_c then WaitForStart
>
>'See if the command was a unit selection or an action.
>
>if CmdData.bit4 = 1 then action
>
>'The command was a unit selection. Save the unit number
>'for later use when we get an action code.
>'NOTE: CmdData is 5 bits, and LastUnit is 4 bits.
>'We already know that the top bit of CmdData is 0, so
>'no data is lost during this operation.
>
>LastUnit = CmdData
>goto WaitForStart
>
>'The command was an action. This is where we decide what
>'to do with it.
>
>action:
>
> debug "House=", DEC CmdHouse, " CmdData=", DEC CmdData, " LastUnit=", DEC
>LastUnit, cr
>
>'If the command was not one we can use with the XOUT
>'command, just ignore it.
>
>if CmdData = %11111 then WaitForStart
>
>'Check for commands we want to expand.
>
>if LastUnit = unit_1 and CmdData = unitOn then AllLightsOn
>if LastUnit = unit_1 and CmdData = unitOff then AllUnitsOff
>if LastUnit = FamilyRoomMotion then DoFamilyRoomMotion
>if LastUnit = PatioMotion then DoPatioMotion
>if LastUnit = PatioDusk then DoDayNight
>
>'If no other specific expansion is set for the command, just
>'repeat the same command using house code G.
>
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\LastUnit,house_g\CmdData]
>goto WaitForStart
>
>
>'
>'The PalmPad (and other remote controls) doesn't have a button
>'for All Lights On. But, we're not using anything on unit 1,
>'so translate that.
>
>AllLightsOn:
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\lightsOn]
>goto WaitForStart
>
>AllUnitsOff:
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\unitsOff]
>goto WaitForStart
>
>
>'
>'When motion is detected on the patio. turn on the dining room
>'light to make it look like someone is investigating.
>
>DoPatioMotion:
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\unit_3,house_g\CmdData]
>goto WaitForStart
>
>
>'
>'The EagleEye sensor in the family room sends on/off commands
>'on channel 5 when it detects motion. Turn on or off the
>'family room light, but only at night.
>
>DoFamilyRoomMotion:
>if CmdData = unitOff then FamilyRoomOff
>
>if Night = 0 then WaitForStart 'don't turn it on in the day
>
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\unit_5,house_g\unitOn]
>goto WaitForStart
>
>FamilyRoomOff:
> 'xout DataOutPin,ClockInPin,[noparse][[/noparse]house_g\unit_5,house_g\unitOff]
>goto WaitForStart
>
>
>'
>DoDayNight:
>if CmdData = unitOn then SetNight
>
>Night = 0
>goto WaitForStart
>
>SetNight:
>Night = 1
>goto WaitForStart
>
>
>'
>'Subroutine to get 1 bit from the input. It verifies
>'that the two pulses for the bit are opposite polarity.
>'If not, it sets BitOK to 0. The data bit is returned
>'in the variable LastBit.
>
>GetBit:
>
>'Assume there will be a problem. We can change it
>'later.
>
>BitOK = 0
>
>'Get two data pulses. They will be saved as the
>'bottom bits of LastData.
>
>gosub GetPulse
>gosub GetPulse
>
>'If the data is good, the two pulses will be opposite
>'polarity.
>
>if LastData.bit1 = LastData.bit0 then badbit
>
>'Indicate we got a good bit, and save the data.
>'Since our input is inverted, we'll use the second of
>'the data pulses as our data. This will implicitly
>'invert the data to make it correct.
>
>BitOK = 1
>LastBit = LastData.bit0
>
>badbit:
>return
>
>
>'
>'Subroutine to get 1 data pulse from the input.
>'It stores the input in last_data, and updates the
>'contents of last_clock. The last_data variable holds
>'the last four data pulses seen, so it needs to be
>'shifted to make room for the new data.
>'NOTE: a pulse on the data line is not the same as a
>'data bit. We need to read two pulses to get one bit.
>
>GetPulse:
>
>'Shift the data now to make room for the new input.
>'We won't have time to do this later.
>
>LastData = LastData << 1
>
>'Wait for the clock input to change.
>
>wait_clock:
>if ClockIn = LastClock then wait_clock
>
>'Read the data ASAP. The data is only valid for 1 mSec
>'so we can't dally here.
>
>LastData.bit0 = DataIn
>
>'Update the clock state. The clock is a 60 Hz square
>'wave, so it remains in the same state for 8 1/3 mSec.
>'It will still be valid after we've read the data.
>
>LastClock = ClockIn
>
>return
>'
>
>
>
>end
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
know of a way to get the stamp to receive x-10 signals? I'm interested in
using x-10 as a way of having stamps talk to each other.
thanks
bob
[noparse][[/noparse]Non-text portions of this message have been removed]