Robo Car Upgrade Peter Busha 4/15/2014
Background O Limited Mobility O Messy Connections O No Auto Power Switch
Proposal Modify the wired Robo car to include: O Wireless Transceiver O Custom circuit board O Master Power Switch O Three Sonic sensors Wireless Transceiver Motor Connections Motor Driver Master Power Switch
Wireless Transceiver MCU Joystick LCD Screen 2.45m To wall Two way data transmission Sonic Sensor Wireless Transceiver
Battery Motor Driver Micro Controller Sonic Sensor Wired Robo Car Joystick Control
Battery Master Switch Wireless Transceiver Motor Driver Micro Controller Robo Car Upgrade Sonic Sensor
KL25Z MCU Robo Car nRF24L01+ Transmitter nRF24L01+ Receiver KL25Z MCU Joystick SPI Communication RF Communication
SPI Communication O Serial Peripheral Interface (SPI) O Four “Channels” O SCLK, CSN or SS, MOSI, and MISO O 8 bit packages
nRF24L01+ O 126 selectable channels O 1.9 to 3.6V supply range O 26µA standby mode, 900 nA power down mode. O Four output powers 0, -6, -12, or -18dBm O 1 to 32 bytes payload length
nRF24L01+ O Transmitter O Reads result of two A to D 16 bit left justified numbers O Breaks 16 bit numbers into bytes O Stores bytes in an array called “payload”. Four arrays, two for vertical and two for horizontal movements. O Transmits payload arrays
/* 1 if we are the sender, 0 if we are the receiver */ #define IS_SENDER 1 #define PAYLOAD_SIZE 16 /* number of payload bytes, 0 to 32 bytes */ #define CHANNEL_NO 50 /* communication channel */ Transmitter Setup
30 ms to transmit payloads 16 byte array. Only using first four bytes. Pulse on MISO receive end This is what a joystick movement looks like
//getting two results from A to D, horizontal and Vert as 16 bit left justified Joystick_GetValue16(data); //breaking A to D to results into bytes payload [0] = (byte)(data[0] / 256); payload [1] = (byte)(data[0] & 255); payload [2] = (byte)(data[1] / 256); payload [3] = (byte)(data[1] & 255); RF_TxPayload(payload, sizeof(payload)); /* send data */
nRF24L01+ O Receiver O Receives the payload arrays O Removes the contents of payload [0] as the vertical data and puts into variable Vert. O Then removes the contents of payload [2] and puts data into variable Horz.
if (status&RF_STATUS_RX_DR){ /* data received interrupt */ RF_RxPayload(payload, sizeof(payload)); /* will reset RX_DR bit */ RF_ResetStatusIRQ(RF_STATUS_RX_DR|RF_STATUS_TX_DS|RF_STATU S_MAX_RT); /* make sure we reset all flags. Need to have the pipe number too */ //Put Payload Data here Vert = payload[0]; Horz = payload[2];
if(((Vert>=115)&(Vert =115)&(Horz <= 140))) {Move(0);}// in center zone car does not move else if(((Vert>=130)&(Horz >= 115))&((Horz<=140)))//To move forward Move(20); else if(((Vert =115))&((Horz<=140))) //To move Backwards Move(-20); else if(((Horz>=130)&(Vert>=115))&((Vert<=140))) //To move Left TurnLeftFast(20); else if(((Horz = 115))&((Vert<=140)))//To move right TurnRightFast(20);
Thank you! Questions?