210 likes | 368 Views
Robo Car Upgrade. Peter Busha 4/15/2014. Background. Limited Mobility Messy Connections No Auto Power Switch. Proposal Modify the wired R obo car to include:. Wireless Transceiver Custom circuit board Master Power Switch Three Sonic sensors. Motor Connections. Motor Driver .
E N D
Robo Car Upgrade Peter Busha 4/15/2014
Background • Limited Mobility • Messy Connections • No Auto Power Switch
ProposalModify the wired Robo car to include: • Wireless Transceiver • Custom circuit board • Master Power Switch • Three Sonic sensors Motor Connections Motor Driver Master Power Switch Wireless Transceiver
Wireless Transceiver Sonic Sensor Two way data transmission Joystick 2.45m To wall MCU Wireless Transceiver LCD Screen
Wired RoboCar Motor Driver Micro Controller Battery Sonic Sensor Joystick Control
Robo Car Upgrade Wireless Transceiver Master Switch Micro Controller Sonic Sensor Sonic Sensor Sonic Sensor Battery Motor Driver
KL25Z MCU Joystick SPI Communication nRF24L01+ Transmitter RF Communication nRF24L01+ Receiver SPI Communication KL25Z MCU Robo Car
SPI Communication • Serial Peripheral Interface (SPI) • Four “Channels” • SCLK, CSN or SS, MOSI, and MISO • 8 bit packages
nRF24L01+ • 126 selectable channels • 1.9 to 3.6V supply range • 26µA standby mode, 900 nA power down mode. • Four output powers 0, -6, -12, or -18dBm • 1 to 32 bytes payload length
nRF24L01+ • Transmitter • Reads result of two A to D 16 bit left justified numbers • Breaks 16 bit numbers into bytes • Stores bytes in an array called “payload”. Four arrays, two for vertical and two for horizontal movements. • Transmits payload arrays
Transmitter Setup /* 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 */
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+ • Receiver • Receives the payload arrays • Removes the contents of payload [0] as the vertical data and puts into variable Vert. • 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_STATUS_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<=140))&((Horz>=115)&(Horz <= 140))) • {Move(0);}// in center zone car does not move • elseif(((Vert>=130)&(Horz >= 115))&((Horz<=140)))//To move forward • Move(20); • elseif(((Vert<=115)&(Horz>=115))&((Horz<=140))) //To move Backwards • Move(-20); • elseif(((Horz>=130)&(Vert>=115))&((Vert<=140))) //To move Left • TurnLeftFast(20); • elseif(((Horz<=115)&(Vert>= 115))&((Vert<=140)))//To move right • TurnRightFast(20);
Thank you! Questions?