1 / 25

On-chip programming and low-level control

On-chip programming and low-level control. Zhongmin Wang zhongminwang@cc.usu.edu CSOIS, ECE Department Utah State University April,1,2004. Mica2 and programming board. Moto Input-output relation. Motor Application. Active Message. PWM. ADC Server. RFM. UART. Motor. ADC. Clock.

lapis
Download Presentation

On-chip programming and low-level control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. On-chip programming and low-level control Zhongmin Wang zhongminwang@cc.usu.edu CSOIS, ECE Department Utah State University April,1,2004

  2. Mica2 and programming board

  3. Moto Input-output relation Motor Application Active Message PWM ADC Server RFM UART Motor ADC Clock Software Sensor Hardware

  4. Mote Components • What is a component ? • Similar to a object in c++ • Provide programming interface • Implementation encapsulated • Main components in mote • ADC server (ADCServer) • Led (Led) • Timer (Timer) • Motor (myMotor) • Communication (myComm) • Xnp (for wireless download) • Robot(main) component signal Component task event command

  5. Component architecture in Mote Note: Low-level feedback control is implemented in robot component. Command interpreter/executer are implemented in the main application

  6. Architecture demonstrated by functionalityApplication=component+scheduler Main (includes Scheduler) Application (User Components) Actuating Sensing Communication Communication HardwareAbstractions

  7. ADC Server component interface ADCServer command init(); command sampleStop(); event frontirDataReady(data); event frontPhotoDataReady(); event rearPhotoDataReady(); event leftEncodeDataReady(); event rightEncodeDataReady(); Note: • The input sensor data length is 10bit,maximum 0x3FF. • Sample rate for each sensor is about 200/s (subject to change) • Give 5 sensor readings at present.

  8. Timer component • Interface Timer • command start(type,interval); • command stop(); • event fired(); • Note: • Type: repeatable or one-time-shot • Interval unit: ms

  9. Communication component Comm Server provide: interface sendMsg(id); interface ReceiveMsg(id); command sendMsg.send(addr, length, &msg); event sendMsg.sendDone( ); event ReceiveMsg.receiver( pmsg) Note: Mote’s capability of communication is about 40 packet / second

  10. Motor component Interface myMotor command init( ); command setPWMInterval( ); command setLeftMotorDutyCircle( ); command setRightMotorDutyCircle( ); command setLeftMotorDirection( ); command setRightMotorDirection( );

  11. Robot component Interface myRobot command init( ); command setLeftMotorSpeed( ); command setRightMotorSpeed( ); command setRobotSpeed( ); command getRobotSpeed( ); command setX( ); command getX( ); command setY( ); command getY( ); command setAngle( ); command getAngle( ); command goDeltaAngle( );

  12. Robot component con’t command goDistance( ); command robotMove(x, y, angle); //overload ADC events, if necessary event frontirDataReady(data); event frontPhotoDataReady(data); event rearPhotoDataReady(data);

  13. Low-level feedback control in Robot • Position feedback PI/PID control, path planning • Speed feedback PI/PID control These two feedback control are being implemented by robot component. The algorithms are running in the background. The running period are defined by Timers.

  14. Set Point Y PID controller Motors Y=speed or position Senor reading to speed or distance Every n milisecond, this control loop will be executed.

  15. Wireless communication protocol • TinyOS ActiveMessage module provides transmit and receive data movement using CSMA/CA based contention avoidance schemes. • In the receive mode, the module accepts bytes of data from the radio and performs the necessary preamble detection, synchronization and CRC calculation/checks. • To transmit, the stack checks to see if the channel is clear by searching for a preamble AND monitoring received signal strength (via the ADC). When the channel is clear, it toggles the radio and pushes out the preamble, sync and payload bytes.

  16. Message type and Command interpreter/executer There are two kinds of output message types Type 1: mote ->station, report sensor reading (sending at constant interval ) Fields: • uint_8t type identifier • uint8_t mote id • uint16_t frontPhotoSensorData • uint16_t backPhotoSensorData Note: General structure of TOS message has destination address. So, it is not included in fields here.

  17. Message type con’t Type 2: mote -> mote, report position and sensor reading (possibly send at request) Fields: • uint_8t type identifier • uint8_t source mote id • int16_t x; • Int16_t y; • int16_t angle; • uint16_t frontPhotoSensorData; • uint16_t backPhotoSensorData;

  18. Message type con’t There are two input messages Type 1: station->mote, give position and next new position Fields: • uint_8t type identifier • int16_t x; • Int16_t y; • int16_t angle; • int16_t newX; • Int16_t newY; • int16_t newAngle;

  19. Message type con’t Type 2: station -> mote, set speed Fields: • uint_8t type identifier • int8_t leftWheelSpeed; • Int8_t rightWheelSpeed; The situation under which the mote can be controlled by other mote is not consider at this phase.

  20. Message type con’t Type 3 station -> mote, update (x, y, angle) information. • uint_8t type identifier • int16_t x; • int16_t y; • int16_t angle;

  21. interpreter/executer Depending on the type of messages received, mote produces command and execute it automatically. swithch ( ) {case: …. }

  22. State variable structure struct robotStructure { int16_t x; int16_t y; double angle; int8_t leftMotorSpeed; int8_t rightMotorSpeed; uint8_t encoderReading; uint8_t frontIRreading; uint8_t frontPhotoResisterReading; uint8_t rearPhotoResisterReading; //add if necessary uint16_t timeStamp //optional structure otherMoteinfo; //optional }robotInfo;

  23. Distributed motes network database • On-mote database helps signal processing on sensor data inside mote. • The way to build a distributed sensor database is to utilize its extended flash memory.( TinyDB for example). • It may not necessary on current stage.

  24. Integrate Motes with Matlab • Tinyos provides tools that help input data to Matlab workspace and send data/command from Matlab to motes via TCP/IP • GUI, PDE controller can be integrated under Matlab environment.

More Related