Robo Car Upgrade Peter Busha 4/15/2014. Background O Limited Mobility O Messy Connections O No Auto...

21
Robo Car Upgrade Peter Busha 4/15/2014

Transcript of Robo Car Upgrade Peter Busha 4/15/2014. Background O Limited Mobility O Messy Connections O No Auto...

Robo Car Upgrade

Peter Busha4/15/2014

BackgroundOLimited Mobility

OMessy Connections

ONo Auto Power Switch

ProposalModify 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.45mTo wall

Two way data transmission

Sonic Sensor

Wireless Transceiver

Batt

ery

MotorDriver

Micro

Controller

Sonic Sensor

Wired Robo Car

Joystick Control

Batt

ery

Master

Switch

WirelessTransceiv

er

Motor Driver

Micro Controller

Robo Car Upgrade

Son

ic Senso

r

Sonic SensorSonic

Sensor

KL25Z MCU Robo Car

nRF24L01+Transmitter

nRF24L01+Receiver

KL25Z MCU Joystick

SPI Communication

SPI Communication

RF Communication

SPI CommunicationO Serial Peripheral Interface (SPI)

O Four “Channels”

O SCLK, CSN or SS, MOSI, and MISO

O 8 bit packages

nRF24L01+O 126 selectable channelsO 1.9 to 3.6V supply rangeO 26µA standby mode, 900 nA power

down mode.O Four output powers

0, -6, -12, or -18dBmO 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 payloads16 byte array. Only using first four bytes.

Pulse on MISO receive end

This is what a joystickmovement 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_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 moveelse if(((Vert>=130)&(Horz >= 115))&((Horz<=140)))//To move forward Move(20);else if(((Vert<=115)&(Horz>=115))&((Horz<=140))) //To move Backwards Move(-20);else if(((Horz>=130)&(Vert>=115))&((Vert<=140))) //To move LeftTurnLeftFast(20);else if(((Horz<=115)&(Vert>= 115))&((Vert<=140)))//To move rightTurnRightFast(20);

Thank you!

Questions?