Tuesday, 6 September 2016

Adding wireless joystick control

The design is the 2 channels of  a 2-axis joystick such as the Parallax Inc 27800, 2-Axis Joystick HMI Module to 2 ADC channels of a Xbee radio. The Xbee is configured to monitor these two ADCs at a rate (IR) of every 200ms. The Xbee sends RX (Receive) Packet: 64-bit address I/O to all other Xbees on the same channel. This packet contains the values of the 2 ADC's.

Parallax Inc 27800, 2-Axis Joystick HMI Module
Parallax Inc 27800, 2-Axis Joystick HMI Module

Another Xbee outputs the packet on it's own TX/RX lines. These are monitored by an Arduino. To demonstrate the communication I have written the sketch robot/sketches/Monitoring_Xbee_IO_packets/Monitoring_Xbee_IO_packets.ino in  https://github.com/epgibbons/robot.git  commit a3d9923efb7b3c30923d6eddbc6df9c8cec0c8f6.

The output displayed in the Serial Monitor window is of the form:
DIO4 is enabled = 1
ADC A0 is enabled  = 521
ADC A1 is enabled  = 511
DIO4 is enabled = 1
ADC A0 is enabled  = 521
ADC A1 is enabled  = 511
DIO4 is enabled = 1
ADC A0 is enabled  = 521
ADC A1 is enabled  = 511
DIO4 is enabled = 1
ADC A0 is enabled  = 521
 

Each axis has range 0-1023 with 521 when the joystick is in the default position.

No comments:

Post a Comment