Unformatted, unordered, brain dump of information for my Mil-Sim airsoft wireless pyrotechnics ignition project. Mostly for my reference but if it helps someone with their xbee project, that’s a bonus.
Code here: http://github.com/insanity54/detpack
Vids here: https://www.youtube.com/playlist?list=PL21r4IMiMKF93vCYHH69TBEh6ASPYJjIf
V2
OSEPP Fio $19
XBee Pro 63mW RPSMA – Series 2B (ZigBee Mesh) $29
-
search for arduino
-
serach for batteries
-
get the right xbee with U.FL connector
Brainstorming
Main components:
(x3) arduino fio – https://www.sparkfun.com/products/10116 – $25 ea.
(x3) XBee Pro 50mW RPSMA – Series 2 (ZigBee Mesh)- https://www.sparkfun.com/products/10419 – $45 ea.
OR
(x3) XBee 2mW RPSMA – Series 2 (ZigBee Mesh) – https://www.sparkfun.com/products/10416 – $29 ea.
(x1) 12 button keypad – https://www.sparkfun.com/products/8653 – $4
(x1) 16×2 OLED display – https://www.adafruit.com/products/823 – $28
(x2) 25pk Basic 5mm LED, Green – https://www.sparkfun.com/products/9855 – $3 ea.
(x2) 25pk Basic 5mm LED, Red – https://www.sparkfun.com/products/9856 – $3 ea.
(x4) Buzzer – PC Mount 12mm 2.048kHz – https://www.sparkfun.com/products/7950 – $2
Prototyping Tools:
(x1) XBee explorer dongle – https://www.sparkfun.com/products/9819 – $25
(x1) 10pk breadboard wire – https://www.adafruit.com/products/153 – $6
(x1) alligator test leads – https://www.sparkfun.com/products/11037 – $3
For final build:
(x?) Resistor networks – ??????????
(x?) Heat shrink – ?
(x?) break-away headers, m & f – $1.50 ea.
(x2) Hook-up stranded wire – https://www.sparkfun.com/products/8865 – $3
I’m still not sure on which XBee units we should use; there are three different network options I have to choose from: 802.15.4, ZigBee, and DigiMesh, each with pros and cons. Also I’m not sure about the range we can expect. We may need the 50mW version, but they are more expensive. Alternatively, there is a 900mHz version which would give us the most range, but that one cost just under $60.
Here’s a quick comparison:
XBee 2mW – Outdoor/RF LOS: up to 400 ft
XBee-Pro 50mW – Outdoor/RF LOS: up to 1 mile
I’m assuming those specs are with a chip antenna or a built-in wire-antenna. I’m sure we could get better range with an external antenna.
simboom Brainstorming 001
This is for the timing circuit. since many things need to branch off the main script, and these things can take some time, while branched off, it can be time for other parts of the script to run, but they cannot because something else is in the process of completing.
Ideas:
• completely eliminate delay()
• reduce serial transmissions
• split everything into fast functions
• code such that time consuming functions are able to pause, and smaller functions are able to complete before time consuming functions resume.
Brainstorming Feb 1 2013
-
Modes
-
Instant detonation
-
timed detonation scheme (strafing effect)
-
Counter-Strike
-
-
Screens
-
Screen is 16×2 character display
-
Status screen
-
R1 1234 S9
R2 12-456 S3
^ ^ ^
| | + Signal strength
| + Charge numbers
+ Remote number -
Charge numbers indicate charge connected to remote
-
Solid = Charge ready
-
Flashing = Comm failure
-
Minus sign = Charge depleted
-
-
Signal strength goes from S0 (no signal) to S9 (excellent signal)
-
-
-
Commands
-
On the transmitter, the admin can issue commands
-
Commands are issued in this format:
remote charge mode enter -
Examples
-
Detonate Charge 4 on Remote 1 now
-
010401#
^ ^ ^ ^
| | | + Enter command
| | + Mode number 1 (instant detonation)
| + Charge number 4
+ Remote number 1
-
-
Detonate Charge 1-6 on Remote 2 and Charge 2-4 on Remote 3 now
-
020106010003020401#
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | + Enter command
| | | | | | + Mode number 1 (instant det)
| | | | | + Charge numbers 2 through 4
| | | | + Remote number 3
| | | + zero zero is a space between commands
| | + Mode number 1 (instant detonation)
| + Charge numbers 1 through 6
+ Remote number 2
-
-
-
Issuing commands via the screen
-
On status screen, scroll to desired Remote number
R1 1234 S9 R2 12-456 S3
R2 12-456 S3 R3 12345-7890 S5 -
Click the rotary encoder
R2 12-456 S3
R3 12345-7890 S5 -
Scroll the rotary encoder to the charge you want to detonate
R2 12-456 S3
R3 12345-7890 S5 -
Click the rotary encoder
R2 12-456 S3
R3 12345-7890 S5 -
Scroll to any other charges you want to detonate
R2 12-456 S3
R3 12345-7890 S5 -
Click the rotary encoder on the charge you want to detonate
R2 12-456 S3
R3 12345-7890 S5 -
Select any other charges you want to detonate
R2 12-456 S3
R3 12345-7890 S5
-
-
-
Strafing
-
S1.5 S
R3 12345-7890 S5 -
S1.5 R3-8 R4-1 _
R3 12345-7890 S5
Counter-Strike
-
2 12-456 S3
R3 12345-7890 S5
Initial prototyping shopping cart
-
x2 850mAh li-pos $8.95 ea https://www.sparkfun.com/products/341
-
x2 Arduino Fio $24.95 ea https://www.sparkfun.com/products/10116
-
x2 XBee Pro 900 RPSMA 54.95 ea https://www.sparkfun.com/products/9099
-
x1 OLED screen 27.95 ea https://www.adafruit.com/products/823
-
x3 piezo buzzers $1.50 ea https://www.adafruit.com/products/160
Provided by Chris:
-
x1 25pk green leds $2.50 ea https://www.sparkfun.com/products/9855
-
x1 25pk red leds $2.50 ea https://www.sparkfun.com/products/9856
-
x1 high-temp tape $4.95 https://www.sparkfun.com/products/10687
-
x1 XBee explorer dongle $24.95 https://www.sparkfun.com/products/9819
-
x1 RGB Rotary encoder $4.95 https://www.sparkfun.com/products/10982
-
x1 plastic knob .95 ea https://www.sparkfun.com/products/10597
-
x1 12 button keypad $3.95 https://www.sparkfun.com/products/8653
-
x1 3.7v 1300mAh $12.00 https://www.adafruit.com/products/258
Related Projects
Other projects utilizing the same rotary encoder
http://www.pavius.net/2010/02/rotary-encoder-based-cooking-timer/
http://www.circuitsathome.com/mcu/programming/reading-rotary-encoder-on-arduino
http://tronixstuff.wordpress.com/2010/06/26/getting-started-with-arduino-chapter-eleven/
Reference
X-CTU in linux (ln -s /dev/ttyUSB0 ~/.wine/dosdevice/com10)
http://www.ladyada.net/make/xbee/point2point.html
http://www.libelium.com/squidbee/index.php?title=How_to_set_XBee_parameters
http://xbee.wikispaces.com/Point+to+Point+Xbee+Set+up
http://tymkrs.tumblr.com/post/18193549622/xbee-multiple-node-discovery-and-rssi
http://www.interactiondesign.se/wiki/xbee:remote_blink
Wireless XBee/AVR bootloading – SparkFun Electronics
http://arduino.cc/en/Main/ArduinoBoardFioProgramming
Tutorial: Arduino and XBee Communication
XBee Digital IO
SimpleTimer Arduino Library IN USE
Timer Arduino Library NOT USED
Metro Arduino Library NOT USED
Arduino 101: Timers and Interrupts
Arduino tutorial 9 wireless communication
Using Remote AT Commands to Toggle an IO on a Remote XBee ZB Radio
XBee DIO max current
321 Plan
XBEE info
-
TRANSMITTER1
-
TYPE: XBP09-DM
-
FIRMWARE VER: 1061
-
S/N: 13A200 409A1BBD
-
-
RECEIVER1
-
TYPE: XBP09-DM
-
FIRMWARE VER: 1061
-
S/N: 13A200 409A1BC7
-
-
RECEIVER2
-
TYPE: XBP09-DM
-
FIRMWARE VER: 1061
-
S/N: 13A200 408DD550
-
-
RECEIVER3
-
TYPE: XBP09-DP
-
FIRMWARE VER: 1061
-
S/N: 13A200 408DD566
-
Setup
-
Set Baud rate to 9600 (3 – 9600 is factory default) (ATBD)
-
Set Network ID to 3259 (Hex is CBB) (ATID)
-
Give each XBEE a node identifier (RECEIVER1, TRANSMITTER1, etc.) (ATNI)
-
Set Destination address (ATDL) to other xbee’s ‘Serial Address Low’ (ATSL)
Wireless bootloading http://arduino.cc/en/Main/ArduinoBoardFioProgramming
-
Programmer XBee’s DL needs to be set to the target XBee. (if DL is set to FFFF it will program ALL in PAN ID)
-
Prepare BASE1 XBee with following parameters
-
(4) BD – Baud Rate
-
(CBB) ID – Modem VID
-
(409A1BBD) DL – Destination Address Low (set to address of PARTIER XBee you want to program)
-
(3) D3 – AD3/DIO3 Configuration
-
(8) IC – DIO Change Detect
-
(3) RR – Mac Retries
-
(10) RO – Packetization Timeout
-
this can be done in one go through a serial program:
-
ATRE,BD4,IDCBB,DL409A1BBD,D33,IC8, RR3,RO10,WR
-
-
Prepare PARTIERx XBee with following parameters
-
(4) BD – Baud Rate
-
(CBB) ID – Modem VID
-
(0) DL – Destination Address Low
-
(5) D3 – AD3/DIO3 Configuration
-
(10) RO – Packetization Timeout
-
ATRE,BD6,ID1234,MY1,DL0,D35,IU0,IAFFFF,RO10,WR
-
-
Make sure to modify the xbee explorer dongle http://arduino.cc/en/Main/ArduinoBoardFioProgramming
-
This setup works but I need to reboot the arduino right before uploading the sketch. I need a way to do this automatically! This has to do with DIO pins and jumpers. Series 2 XBees aren’t capable of doing this. The 900 is a series of it’s own, is the 900MHz capable? CLUES HERE: http://letsmakerobots.com/node/23869
-
I’m pretty sure our explorer dongle is modded correctly, however this page says the DTR pin is the pin that should be jumpered???
-
I think the DIO pin configuration on the controller xbee need looking at.
-
900 MHz XBees cannot do this. The issue is that automatic digital I/O line passing is not supported on the 900MHz XBees
-
Firmware Types
-
XBP09-DP is point-to-multipoint firmware (we are using this)
-
XBP09-DM is digimesh
The manual says AT command CI is only supported in AT firmware. We are able to use ATCI so we must be using AT firmware.
Series
-
900MHz XBees are their own series. They are however very similar to series 2, 900 MHz XBees use ZNet.
-
Series 1 have individual firmware for each type (end device, router, coordinator)
-
Series 2 have 1 firmware that does every mode (end device, router, coordinator)
-
Series 2 does not have ATMY
-
Series 900 MHz does not have ZigBee. Only Digimesh & Point-to-point, point-to-multipoint, peer-to-peer
-
Series 900 MHz XBee API frames are different from other series
-
PAN is synonymous with Network ID
C++ Notes
http://arduino.cc/en/Reference/StringToCharArray
http://playground.arduino.cc/Code/Library#Syntax
Timer Interrupts
-
Timer0 will be used for updating the display every 1s (NO IT WONT)
Buzzer!
http://www.globalsources.com/gsol/I/Electromagnetic-buzzer/p/sm/1052536411.htm
http://www.rapidonline.com/audio-visual/electronic-buzzer-71396/
Manufacturing Ideas
Use OSH Park, it’s what Adafruit uses
Feb 04 NOTES
Get the following:
-
Get (x2) 900MHz XBEE
-
Get (x3) adapter boards for XBEE
-
Get (x4) 3.7V batteries
-
Can the arduino charging circuit handle that large of a battery?
-
if 2200 mAh is not supported on arduino, get a charging board
-
-
(x3) Relays
-
3V switching (input. what it runs at)
-
rating 5V @ 1A or 20V @ 0.5A
-
we need 3.5-4V @ 0.5A on the output
-
there should be logic level in relays
-
can be a solid state switching transistor
-
-
(x8) key switches
-
find out if they’re keyed the same
-
KEY LOCK needed
-
screen to sleep, controls locked, but still talks to remotes
-
-
(x4) 900MHz antennas
-
NEEDED FEATURES BY END OF FEB
-
manually type in receiver & detonate
-
trigger fire command list
-
-
Mountable LEDs
-
Transmitter
-
Green Power LED
-
Orange LED
-
-
Receiver
-
Green Power LED
-
Red ARM LED
-
Orange LED
-
Can we re-locate the charge LED?
-
-
-
-
(x1) SD Card slot
-
Look for different keypad for extended input
-
period, dash
-
-
Removable screw terminals
-
6 pin for main
-
DB25 maybe
-
-
Protoboard
-
-
boxes
-
Take note of each electronic’s pin usage
-
XBEE
-
Menu Options
-
Command mode
-
Firing Scripts
-
Strafe mode
-
Designate delay betwen each charge, enter charges
-
-
Counter-Strike mode
-
Enter receiver number & countdown time
-
Enter allowed disarming method
-
-
-
Signal strength
-
Connecting arduino to relays
Digital I/O Line Passing
-
Conventions
-
In this section, we refer to the “remote” and the “base”. In this case, the remote is a DetPack ‘dumb receiver’ and the base is a DetPack ‘smart transmitter’
-
DIO stands for Digital Input/Output
-
-
Process
-
Remote checks every n milliseconds where n is the DIO line timer. (ATTn where n is DIO pin)
-
Sample rate is the length of time the XBee checks the DIO line. sample
|—-|————————–|
^ ^ ^
\ | timer
\|
sample rate -
The 900MHz XBee does not have a timer feature, only a sample rate (why?)
-
-
Clues from the Digi Knowledgebase article, XBee 802.15.4 Digital Input/Output Line Passing
-
Enable DIO lines on the XBee remote
-
ATDn=3 where n= 0-7 (the DIO pin you wish to use)
-
-
Enable DIO Lines on the Xbee base
-
ATDn=4,5 where n= same DIO pin as XBee remote. (4 is DO default low and 5 is DO default high) Use the same DIO pin we used on the remote)
-
-
Set DIO Line Sampling and timers
-
-
Reference
-
The spec-sheet says DIO line passing isn’t supported on the 900MHz XBee… The internet concurs. CRAP! We need a work-around! I think Remote AT command execution using the API is our best bet!
Using Remote AT Commands to toggle an IO on a Remote XBee
-
Reference
-
Setup
-
Put XBee in API mode with escapes (ATAP=2)
-
???
-
Send Remote AT command in an API packet
-
Refer to XBee/Xbee-PRO ZB RF Modules manual, pg 108 for a breakdown of the packet.
-
7E 00 0F 17 01 7D 33 A2 00 40 9A 1B C7 FF FE 02 49 52 DC
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | |
| | | | | | | | | | | | | |
| | | | | | | | | | | | |
| | | | | | | | | | | |
| | | | | | | | | | |
| | | | | | | | | |
| | | | | | | | |
| | | | | | | |
| | | | | | |
| | | | | |
| | | | |
| | | | Frame ID. if set to 0, no ACK is sent
| | | frame type
| | length end
| length start (num of bytes between length and checksum)
start delimiter
-
-
phone notes Feb 9
-
There are solid state relays that we can use
-
XBee API Mode Reference
-
ATIS shows status of all DIO pins
-
Error codes
-
1 – CHECKSUM_FAILURE
-
2 – PACKET_EXCEEDS_BYTE_ARRAY_LENGTH
-
3 – UNEXPECTED_START_BYTE
-
If you get one of these, the arduino probably isn’t reading packets fast enough and the rx bufffer becomes overloaded, dropping bits
-
-
All TX packets extend the XBeeRequest class
-
All RX packets extend the XBeeResponse class
-
Each TX and RX packet is identified by a unique API ID
-
Transmit packets
-
AtCommand
-
For executing/querying AT commands on a local XBee
-
AT_COMMAND
-
-
RemoteAtRequest
-
For executing/querying AT commands on a remote XBee
-
REMOTE_AT_REQUEST
-
-
ZNetTxRequest
-
series 2
-
-
-
Receive Packets
-
AtCommandResponse
-
Sent in response to AtCommand and indicates if the command was successful. If the command was a query, it will contain the configuration value
-
AT_RESPONSE
-
-
ModemStatusResponse
-
Sent by the local XBee on certain events, such as Association, Disassociation
-
MODEM_STATUS_RESPONSE
-
-
RemoteAtResponse
-
Sent in response to a RemoteAtRequest
-
REMOTE_AT_RESPONSE
-
-
ZNetTxStatusResponse
-
Sent after a ZNetTxRequest packet. Indicates if transmission was successful
-
ZNET_TX_STATUS_RESPONSE
-
-
ZNetRxResponse
-
Received on the remote radio after a ZNetTxRequest packet is sent
-
ZNET_RX_RESPONSE
-
-
ZNetExplicitRxResponse
-
ZNET_EXPLICIT_RX_RESPONSE
-
-
ZNetRxIoSampleResponse
-
sent by a remote XBee, configured to send I/O samples
-
ZNET_IO_SAMPLE_RESPONSE (0x92)
-
-
-
Reading a Packet Code Example!
// if there is any response at all
if (xbee.getResponse().isAvailable()) {
// check that the packet is the api packet type we were expecting
if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
// populate the reponse packet in our xbee object
xbee.getResponse().getRx16Response(rx16);
}
}// Now we have the RX packet.
// using it, we can check the source address (the radio that sent the packet)
rx16.getRemoteAddress16();// we can also get the RSSI (signal strength)
rx16.getRssi()// and access the payload. (print it to softwareSerial for helpfulness
// since the data is split into bytes, we use a for loop to iterate
// through and print each byte.
for (int i = 0; i < rx.getDataLength(); i++) {
nss.print(rx.getData(i), BYTE);
}// we can also access the payload as an array, possibly to pass it to a
// function for processing.
processpayload(rx.getData(), rx.getDataLength());
-
RemoteAtCommandResponse Class
-
getCommand()
-
Returns the command status code.
-
Zero represents a successful command
-
-
getStatus()
-
Returns an array containing the command value.
-
This is only applicable to query commands.
-
-
getValue()
-
Returns the length of the command value array.
-
-
getValueLength()
-
Returns the 16-bit address of the remote radio
-
-
getRemoteAddress16()
-
Returns the 64-bit address of the remote radio
-
-
getRemoteAddress64()
-
Returns true if command was successful
-
-
SoftwareSerial to PC connection
Issue:
I need to be able to get serial communications from the arduino (for debug purposes) without using the ardunio’s hardware serial. The reason for this is that the Arduino Fio uses hardware serial to communicate with the XBee, thus tieing up hardware serial.
Goal:
Serially connect the arduino to the PC using pins A0 and A1 (serial RX & TX respectively) using the arduino SoftwareSerial library
Issues:
-
How do I wire the connection between arduino and my FTDI basic breakout board?
-
What pins do I need to use on the FTDI basic breakout board??
-
Is the FDTI basic breakout board sufficient for this purpose???
Pins on our FTDI basic
-
GNS
-
CTS
-
3.3V
-
TX0
-
RX1
-
DTR
I suspect I need 4 wires. TX, RX, GND and 3.3V. Here is my evidence of this.
Here is a nice tutorial on SoftwareSerial
Here is the official arduino SoftwareSerial reference page
This guy is doing it good!
Solution
-
Only 2 Pins are needed! RX and TX.
-
Connect arduino RX to FTDI TX
-
Connect arduino TX to FTDI RX
-
-
My FTDI basic breakout board works just fine for this purpose.
Needed For end of Feb
-
Pre-stored firing list
MEGA GOALS (Goals that need shattering by Feb 28)
-
turn DIO pin ON
-
turn DIO pin OFF
-
time the above
-
menu to select timer profiles
MEGA GOALS 2 (Goals that need explosioneered by March 30)
-
Low battery indicator on Arduino??
-
see here
-
-
Menu of firing scripts
-
RSSI indicator (show in range of receiver or not)
-
LOCKOUT switch!
Troubleshooting and sporatic thoughts
-
we send command 7382 which is IR
-
After sending the remote AT packet, we get this strange value from remoteAtResponse.getValue()
-
FFFF4430200001E56E500008387EB698488469359000B7E7EB4DE7EE5EEA7E063300E83000000E126022803207207207000AA3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002550A2130C71B9A405B317150352320A2130C71B9A40FEFF10000000000000000000000FFFF0080
-
Ignore this. it’s not the data you’re looking for.
-
-
“Expected Remote AT response but got 92”
-
Sample packet (API packet frame type 0x92 – ZigBee IO Data Sample Rx Indicator)
-
it’s not a sample in the sense of “here’s a sample of our new product”
-
it’s a sample of a DIO pin.
-
-
-
Bitwise AND, and Bit Shift operators
-
‘&’ is a bitwise AND operator
-
‘<<’, ‘>>’ are bit shift operators
-
payload[0] = pin5 >> 8 & 0xff;
payload[1] = pin5 & 0xff; -
In this example, we are shifting the value of pin5 8 bits to the right, essentially cutting off the last 8 bits of the value. Then we are using a bitwise AND to cut off any bits preceeding the last 8 bits of the remaining value. This value is being stored as the first value in an array, payload.
In this case, the values of payload need to be 1 byte (8 bits), so we are splitting the 16-bit pin5 data into two bytes.
-
Illustrated example:
-
if pin5 was originally: 0101110100110111
-
pin5 >> 8 0101010101011101
-
1010101011101 & 0xff 01011101
-
-
-
Next, we are using a bitwise AND operation to store the part we cut off originally.
-
Illustrated Example
-
value of pin5 0101110100110111
-
pin5 & 0xff 00110111
-
-
-
-
Talking process
-
Control XBee says, “D0 5”
-
Det XBee replies,
-
-
Recommended Pin Connections (from the manual pg. 15)
-
only required pins are VCC, GND, DOUT, DIN
-
for serial firmware updates, VCC, DOUT, DIN, RTS, and DTR should be connected.
-
-
LED pins
-
associate LED is pin 15
-
commissioning pin is pin 20
-
-
MOSFET tut
-
http://bildr.org/2012/03/rfp30n06le-arduino/
-
-
KEYPAD
-
tutorial for same keypad
-
-
ROTARY ENCODER
-
pinout
-
1: common
2: blue
3: button
4: green
5: red
6: encoder data
7: encoder common
8: encoder data
1 2 3 4 5
| | | | |
===========
===========
| | |
6 7 8
lcd creatChar
-
padlock 14,17,17,31,27,27,31
-
firing scripts
-
R1-1
-
R2-1
-
R3-1
-
R1-2 + R2-2
-
R2-7 + R3-3
-
R1-8, P1, R2-3, P1, R3-3 # P is pause
-
Arty strike:
-
R1-1 (Rocket1 launch)
-
Pause 4s
-
R1-2 (Rocket2 launch
-
Pause 1s
-
R2-1 (Rocket1 impact)
-
Pause 2s
-
R1-3
-
Pause 1s
-
R2-2
-
Pause 4s
-
R2-3
-
-
-
Smart Receiver Payload Format
-
Send options
-
IG – Ignite Command
-
FS – Firing Script
-
DA – De-activate
-
RA – Range check
-
ST – Status request
-
SS – Strafe Command
-
CS – Counter-Strike Command
-
CC – C4 Mode Enable
-
-
Theory
-
Ignition command
-
Transmitter tells receiver to ignite charge n
-
Receiver acknowledges the command
-
Transmitter displays a thumbs up
-
Receiver ignites charge n
-
-
Artillery script
-
Transmitter tells receivers their firing mission
-
Transmitter tells receivers the time
-
Receivers acknowledge their firing mission
-
Receivers acknowledge the time
-
Transmitter tells receivers to execute their firing mission at time x
-
-
-
Class call
-
SmartPayload sp = SmartPayload();
-
xbee.send(sp.ignite(0,2)); // ignite receiver 1 queue 3
-
-
ASCII I = HEX 0x49 = DEC 73
ASCII G = HEX 0x47 = DEC 71
ASCII F = HEX 0x46 = DEC 70
ASCII S = HEX 0x53 = DEC 83
ASCII D = HEX 0x44 = DEC 68
ASCII A = HEX 0X41 = DEC 65
9,12,24,49,0,0,134.
artillery timing:
123456789012345678
oooooooooooooooooo
^ ^ v ^ v v
99 after parsing is a pause
-
Menu System
-
3 parts
-
User Input
-
OLED Display
-
Menu Position Logic
-
-
-
FrameType is the type of API packet, such as a RemoteATCommandRequest
-
Frame ID identifies the UART data frame being reported. Soo… In Layman’s terms, it identifies the frame. It can be set to anything. If set to 0, the frame will not be sent out of UART
-
Cluster ID’s are a set of attributes and commands that can be supported in multiple ZigBee profiles. Laymans terms: These are used for developing ZigBee products that will interoperate in a public profile such as home automation or smart energy.
-
Profile ID’s are ZigBee device profiles. 0x0000 is the ZigBee device Profile that supports ZDOs
-
ZDOs are ZigBee Device Objects. Used for passing around usefull stuff to other ZigBee devices
-
Broadcast Radius is the max number of hops a broadcast transmission can traverse. If set to 0, the transmission will be set to the network max hops value
-
Transmit Option specifys if the extended timeout should be used for a given transmission. Set if:
-
The application sends data to 10 or more remote devices, some of which are end devices, AND
-
The end devices may sleep longer than the unicast timeout
-
SweetMenu
Data we need to pass around:
-
menuActive
-
menuAction
http://home.netcom.com/~tjensen/ptr/ch1x.htm pointer reference
Connection indicator (RSSI without the RSSI)
-
Possibile solution:
-
AT Command ND is Node Discover. This Discovers and reports all RF modules found. The following information is reported for each module discovered
-
Won’t indicate association.
-
-
BETTER IDEA:
-
the Explicit Transmit API frame (0x11) can be used to send an “Active Endpoints” request to discover the active endpoints
-
90000976_G.pdf pg. 123
-
Can’t do this with xbee-arduino library (0x11 not supported)
-
-
How about this?
-
In API mode, all received RF data frames indicate the source address
-
Battery Monitoring
-
AT Command %V is Supply Voltage. It reads the voltage on the VCC Pin. Scale by 1200/1024 to convert to mV unites. For example, a %V reading of 0x900 (2304 decimal) represents 2700mV or 2.7V
Known Issues
Firing fails if arduino powered on few seconds before.
Cause:
Transmitter isn’t associated yet
Fix:
don’t let transmitter send until associated.
Xbee API 0x91 packets are sent at seemingly random intervals, and instead of AT RemoteCommand response packets
Suspected Cause:
-
Receiver is associating
-
receiver is just saying “hi”?
-
Our xbee library does not support DM packets
Verified Cause:
-
This is a ZigBee Device Announce broadcast transmission
-
It is sent when a ZDO device joins a ZigBee network.
-
Payload:
-
[Sequence Number] + [16-bit address] + [64-bit address] + [Capability]
-
-
Fix:
-
This is not actually a problem. Adapt code to recognize these packets.
Transmitter has no error checking
Description:
Transmitter is dumb and just sends a setCharge command, without checking to see if the receiver got the message.
Cause:
feature hasn’t been implemented
Fix:
Implement it, damnit!
4 5/16 width 109.538 mm
6 3/16 length 157.162 mm
1 ¾ – 2” thick 44.45 mm
MARCH 30 PREP SHOPPING LIST
-
x3 arduinos tigerdirect
-
power switch
-
sleep switch
-
low profile headers
-
resistors for battery voltage monitor
-
keypad driver??? yes that would be good
Low cost version
-
https://dx.com/p/nrf905-wireless-communication-transmission-module-for-arduino-148058
-
https://dx.com/p/rf2401se-dual-channel-wireless-transmit-receive-module-green-156830
-
https://dx.com/p/nrf24l01-pa-lna-wireless-communication-modules-w-antenna-for-arduino-148822
Pegasus 5 prep
smart receivers are only listening for first four chars of command payload ex: 70, 83, 1, 5
GALAXY ULTRA TODO
-
auto reset charges
-
full expected functionality of last version
-
event loop
-
packet received?
-
get command type
-
while there are chars to parse
-
is it my remote # and a charge?
-
yes it’s my number
-
ignite charge
-
-
no it’s not my number
-
ignore.
-
-
no, it’s a special command.
-
delay
-
find current time, plus delay time. this is the point in time our future event needs to execute.
-
tell event loop there is a future event
-
return to event loop
-
-
-
-
-
-
-
is there a future event & it is time to resume from delay?
OR??
break command payload into individual commands
say you have:
F,S,1,0,121,5,0,1,128
simplified, it means:
1,0 121,5 0,1
fire R2-1 wait 5 seconds fire R1-2
In English, the microcontroller needs it in this format:
fire R2-1 at 0 seconds
fire R1-2 at 5 seconds
In code, this is the format:
char order[72][3] = {
{1,0,1}, // R2-1 ON
{0,1,1} // R1-2 ON
long orderTime[72] = {
0, // at 0 seconds
5000 // at 5 seconds
setup
int cmdPayloadType;
loop
-
event loop
-
if packet received
-
State machine.
(looking for: 0 = first char of payload type,
1 = second char of payload type,
2 = receiver number or special command,
3 = charge number,
4 = special command parameter,
5 = ignore this value.) -
While there are chars to parse
-
Store char currently being parsed for faster performance: (inspectChar = command[charPos])
-
state?
-
0 (looking for first char of payload type)
-
if inspectChar == ‘F’
-
cmdPayloadType =
-
-
-
1 (looking for second char of payload type)
-
if command type is FS
-
state = 2
-
-
-
2 (looking for receiver number or special command)
-
if number is less than 100
-
if number is my receiver number
-
state = 3
-
-
else
-
state = 5 (will ignore next value)
-
-
-
else
-
if special command is 128
-
break out of while loop
-
-
if special command is 120
-
delayMultiplier = 1
-
delay = inspectChar
-
delay time will be milliseconds
-
state = 4
-
-
if special command is 121
-
delayMultiplier = 1000
-
delay time will be seconds
-
state = 4
-
-
if special command is 122
-
delayMultiplier = 60000
-
delay time will be minutes
-
state = 4
-
-
-
-
3 (looking for charge number)
-
order[x] = inspectChar
-
state = 2
-
-
4 (looking for special command parameter)
-
orderTime[x] = inspectChar * delayMultiplier
-
state = 2
-
-
5 (ignore this value)
-
state = 2
-
-
-
-
-
-
I am now looking for a receiver number or special command number.
-
If number < 100 it’s a receiver number
-
I am now looking for a charge number.
-
-
while there are chars to parse
-
am
-
if it is my remote #
-
next iteration will be my charge number.
-
-
78, 76, 1, 5, 121, 5, 2, 3
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | |
coo
coo
aite
ok ————————- action[x] = {5, 1};
oh a delay
by 5 seconds? k. — time[x] = {5000};
coo
aite
78, 76, 1, 5, 121, 5, 2, 3, 1, 4, 121, 4, 2, 4
^ ^ ^ ^ ^ ^ ^ ^ ^ ^
| | | | | | |
coo
coo
aite
ok ————————- was there a delay command before me?
no? ok, time[x] = 0; action[x] = {5, 1};
oh a delay
by 5 seconds? k. — time[x] = {5000};
coo
aite
123456789012345678901234567890123456789012345678901234567890
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
^ ^ ^ ^
f i f i
123456789012345678901234567890123456789012345678901234567890
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
^ ^ ^ ^
f i f i
123456789012345678901234567890123456789012345678901234567890
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
^ ^ ^ ^
f i f i
70,83,133,133,33,133,133,133,32,133,133,133,32,0,133,0,0,133,0,133,133,0,133,133,0,133,133,0,133,133,0,133,133,0,133,133,0,133,133,0,133,0,0,133,0,133,133,0,
ts and dereferencing, just copy.
Serial.println( buffer );
012345678901234567890123456789012345678901234567890123
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
^