WEP 1035 Programming WEP 1035. AGENDA Introduction to Mbed Registration on Mbed Developer Website Hello World/Blinky Program Electrical Schematic Overview.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Advertisements

Lecture 1 – Arduino Basics
ECE 480 Design Team 3 Technical Lecture
Lab7: Introduction to Arduino
ARDUINO FRAMEWORK.
An open source platform for IoT Bogdan Marinescu mbed.
The Developer Summit at ARM® TechCon™ 2013 MBED Hello World Lab 1 mbed registration and hello world!
Motor Control Lab Using Altera Nano FPGA
ECE 4220 Real Time Embedded Systems Final Project Presentation Spring 2014 University of Missouri Columbia By: Michael Brauch Temperature Data Logger.
Getting Started with a Cortex-M3 Board
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
BLDC MOTOR SPEED CONTROL USING EMBEDDED PROCESSOR
Robotics Research Laboratory Louisiana State University.
In this PPT, all the materials covered up for the PIC microcontroller set-up would be studied. Preliminary skills: Knowing of basic C grammar and basic.
1 mbed Hands-On Instructor Workshop ESWEEK Agenda mbed Hands-On Instructor Workshop – The ARM University Program - Khaled Benkrid, ARM UP Manager.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
Jordan Wagner Justin Spencer Mark Sears John Jachna.
2.0 EMBEDDED CONTROLLER Engr. Hj. Mohamad Fauzi bin Zakaria Department of Mechatronics and Robotics Engineering Faculty of Electrical and Electronic Engineering.
PANTOGRAPH. IDEA This pantograph is one of my robotics projects that we have to make and build in the university. When I thought about making this project.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
September, 2007ENGR Low-Level Robot Control Mechatronics: Motors, sensors & embedded controls.
Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.
Weston Schreiber & Joshua Gabrielse Robotics Summer Training Programming #1: EasyC Basics.
The New FTC Platform (Connecting your legacy hardware)
Camilo Martinez Advisor : Dr. Cris Koutsougeras Dept of Computer Science and Industrial Technology Southeastern Louisiana University.
Typical Microcontroller Purposes
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
BEST Robotic, Inc. easyC Breakout Session By: Guy Chetrit Programming With easyC September 15, Copyright © 2012 BEST Robotics, Inc. All rights reserved.
Intro to Arduino Programming. Draw your circuits before you build them From Arduino 330 Ohm From Arduino 330 Ohm From Arduino 330 Ohm.
Zach Molden Shamlan Al-Roomi NJ Purevsuren Raied Farash Aadiel Rizvi C ritical D esign R eview.
David GiandomenicoFeedback Control for your FIRST Robot’s DrivetrainDec 2010 WRRF Workshops #1 David Giandomenico Team mentor for Lynbrook Robotics – Team.
RED ROVER Team CPNE Crossen Davis Peter Ramer Nancy Robinson Eric Rodriguez.
Dan O. Popa, Freshman Seminar Spring 2015 EE 1105 : Introduction to EE Freshman Seminar Lab-Lecture: Op Amp Circuits, Embedded Computing.
Designing with Components Wilmer Arellano. How to chose a Microcontroller Choose one that you are familiar with or that is easy to learn.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Team 6 DOODLE DRIVE Alexander Curtis Peachanok Lertkajornkitti | Jun Pan | Edward Kidarsa |
External Use TM Hands-On Workshop: ARM mbed™ FTF-DES-F1302 JUN.2015 Sam Grove - ARM Michael Norman – Freescale.
Jason Crim Vikas Kedigehalli Chinnappa Pattada.
Session 12 Sensors and Timers. 3 Main Types of Robot Projects Command-Based Robot A more complicated project for more complicated robots Iterative Robot.
Alex Wanamaker.  2 astable 555 timer circuits  Blinking rate: ~1.1 seconds  Q1 and Q2 used to provide additional current for the circuit beyond.
Day 1 - Intro WEP 1035.
Microcontrollers, Microcomputers, and Microprocessors
Wireless TYWu. 433Mhz RF link kit Picture 433Mhz RF link kit Specification –Frequency: 433Mhz. –Receiver Data Output: High - 1/2 Vcc, Low - 0.7v –Transmitter.
ECE 477 FINAL PRESENTATION TEAM 6  SPRING OUTLINE  Project overview  Block diagram  Design challenges  Individual contributions  Project demonstration.
Motor TYWu.
RenBED – Technical Training Jon Fuge – Renishaw plc.
Networks ∙ Services ∙ People Domenico Vicinanza TNC2015 Creating Interactive Art with Prototype Boards and R&E Networks Porto, Portugal,
Microcontroller basics Embedded systems for mortals.
SmartCup – Team 42 Harington Lee, Chirag Patil, Arjun Sharma 1.
Istituto Tecnico Industriale A.Monaco EURLAB Control a Servo Motor If you want to swing an robot arm or … steer a robot you need a special motor (Servo).
Session 6 John Wolf (WolfDenElectronics.com). Objectives – We’ll Learn  Code to Voice  PIR sensors – motion detection  Quadrature Encoders  Audio.
ECE ILLINOIS. ECE 445 Spring 2016 Smart closet Group 24 Luchuan Zhang Yiwei Li.
HOME SECURITY USING WIRELESS SENSOR NETWORK UNDER THE ESTEEMED GUIDANCE OF: P.RAMESH D.SIVOM( ) KANMANI RAVI( ) B.SAI RAJSEKHAR( )
Voice Controlled Robot by Cell Phone with Android App
SPiiPlus Training Class
PICK N PLACE ROBOTIC ARM AND MOVEMENT CONTROLLED BY ANDROID WIRELESSLY
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
80C51 Block Diagram ECE Overview.
Manual for Arduino Kit v1.0
ARDUINO LINE FOLLOWER ROBOT
ECE477 MIDTERM DESIGN REVIEW: TEAM #08
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Movement using Shaft Encoders
PICK N PLACE ROBOTIC ARM AND MOVEMENT CONTROLLED BY ANDROID WIRELESSLY
Virtual Presence Vehicle Team 13
Ethan Hall Michael Kelton Greg Wegman Vashisht Lakhmani
Robotics System Lecture 11_12: DC Motor
Model Blimp Design Competition Programming Workshop by Youth College (International) / VTC May
Presentation transcript:

WEP 1035 Programming WEP 1035

AGENDA Introduction to Mbed Registration on Mbed Developer Website Hello World/Blinky Program Electrical Schematic Overview of the PCB Importing Skeleton Code Libraries Overview Begin Programming (Declarations and Initializations)

INTRODUCTION TO MBED NXP LPC1768 MCU ARM® Cortex™-M3 Core 96MHz, 32KB RAM, 512KB FLASH Ethernet, USB Host/Device, 2xSPI, 2xI2C, 3xUART, CAN, 6xPWM, 6xADC, GPIO Prototyping form-factor 40-pin 0.1" pitch DIP package 5V USB or 4.5-9V supply Based on 3.3V Logic Built-in USB drag 'n' drop FLASH programmer

INTRODUCTION TO MBED High level C/C++ SDK USB Drag ‘n’ Drop Programming Interface

INTRODUCTION TO MBED mbed.org Developer Website Online Compiler Entry-level Online Compiler Nothing to Install: Browser-based IDE Immediately compiling examples or writing your own

REGISTRATION After Signup: Choose LPC1768 Platform

BLINKY PROGRAM

HELLO WORLD PROGRAM

ELECTRICAL PCB OVERVIEW IMU MBED Motor Driver Fuse Camera DC Conv 5V DC Conv LED

ELECTRICAL PCB OVERVIEW

IMU (Sparkfun - SEN 10121) ADXL345 accelerometer (3-axis accelerometer) Measures accelerations in x, y, z (m/s^2) ITG-3200 gyro (3 axis gyroscope) Measures angular velocity in x, y, z (rads/s) 3.3V input I2C interface (Refer to Altium Schematic) Used on the robot for measuring the tilt (pitch)

ELECTRICAL PCB OVERVIEW Motor Driver (Dual MC33926 Motor Driver) PWM Pins: Motor 1: M1D2 Motor 2: M2D2 Directions Pins Motor 1: M1IN1, M1IN2 Motor 2: M2IN1, M2IN2

ELECTRICAL PCB OVERVIEW DC Motors 70:1 metal gearbox Quadrature Encoder 16 pulses per rev 64 counts per rev (16x4) Channel A & B on interrupt pins Refer to Altium Schematic

NEOPIXEL LEDS Tiny, bright RGB pixels Daisy Chain Design Only 8mm x 10mm Need 1 pin/wire to control all the LEDs in the chain

IMPORTING SKELETON CODE

ETHERNET/UDP DECLARATIONS // Ethernet Declarations here static const char* robotIP = " "; //Robot IP static const char* mask = " "; // Mask static const char* gateway = " "; //Gateway const char* broadcastIP = " "; //broadcast it const int port = 8888; char packetBuffer[10]; //Buffer for receiving the UDP Packets (in our case from the Android Tablet) UDPSocket sendSocket; //Socket for sending UDPSocket receiveSocket; //One for receiving Endpoint broadcastServer; //Where you send the debug messages Endpoint client; //where you receive your messages from

ETHERNET/UDP SETUP AND INITIALIZATION EthernetInterface eth; // eth.init(); //If you want to use DHCP enable this eth.init(robotIP, mask, gateway); //For Static IP while (eth.connect()<0); //Get stuck here if ethernet is not setup successfully #ifdef SERIAL_DEBUG pc.printf("IP Address is %s\n", eth.getIPAddress()); pc.printf("Network Mask is %s\n", eth.getNetworkMask()); pc.printf("Gateway is %s\n", eth.getGateway()); #endif sendSocket.init(); sendSocket.set_broadcasting(); //Needed for broadcasting... receiveSocket.bind(port); receiveSocket.set_broadcasting(); receiveSocket.set_blocking(false,50); broadcastServer.set_address(broadcastIP, port); wait_ms(500); #ifdef SERIAL_DEBUG pc.printf(" UDP setup complete!\n" ); #endif

UDP RECEIVE PACKETS int receivedBytes = receiveSocket.receiveFrom(client, packetBuffer, sizeof(packetBuffer)); if(receivedBytes) //UDP bytes received { switch(packetBuffer[0]) { case 0x00: // Open Loop joystickAlive = true; status = 1; //In Open Loop openLoop(); break; case 0xF0: mbed_reset(); break; case 0xF1: //To do break; case 0xF2: //To do break; case 0xF3: //To do break; case 0xF4: //To do break; }

ETHERNET WIRING TO MBED Rx-Green Rx+White/Green Tx-Orange Tx+White/Orange

MOTOR DRIVER DECLARATIONS //MC Motor Controller Pinout Declaration #define M1D2 p26 //PWM Pins #define M2D2 p25 //PWM Pins #define M2IN2 p24 #define M2IN1 p23 #define M1IN2 p22 #define M1IN1 p21 //Declaration of the Motor Driver Objects Motor leftMotor(M1D2,M1IN1,M1IN2); Motor rightMotor(M2D2,M2IN1,M2IN2);

ANDROID JOYSTICK APP

MOTOR DEADBAND Joystick Command Motor Command 255 (Max Forward Speed) (Min Forward Speed) ~ (Stop) (Min Reverse Speed) ~ (Max Reverse Speed)

MOTOR CONTROL FUNCTION void openLoop() { //Equations to map the android joystick from leftMotorSpeed = ((float)packetBuffer[1] f * ((float)packetBuffer[4]-127))/-128.0f*0.6; rightMotorSpeed = ((float)packetBuffer[1] f * ((float)packetBuffer[4]-127))/128.0f*0.6; //Dead Zone Corrections if (leftMotorSpeed>0) leftMotorSpeed+=0.4; if (leftMotorSpeed<0) leftMotorSpeed-=0.4; if (rightMotorSpeed>0) rightMotorSpeed+=0.4; if (rightMotorSpeed<0) rightMotorSpeed-=0.4; //Setting the Motor Speed leftMotor.speed(leftMotorSpeed); rightMotor.speed(rightMotorSpeed); //Setting colors for the neopixel (Will be done later) #ifdef SERIAL_DEBUG pc.printf("leftMotorSpeed: %f\n",leftMotorSpeed); pc.printf("rightMotorSpeed: %f\n",rightMotorSpeed); #endif }

IMU DECLARATIONS //IMU Declaration #define IMU_INT1 p8 #define IMU_SDA p9 #define IMU_SCL p10 #define IMU_INT0 p11 SEN10121 imu(IMU_SDA, IMU_SCL); Ticker imuFilterTicker; //A recurring interrupt for filtering IMU data

IMU SETUP AND INITIALIZATIONS #ifdef SERIAL_DEBUG pc.printf(" Initializing & Calibrating IMU.\n" ); #endif //IMU Initialization and Calibration imu.initialize(); imu.calibrate(); imuFilterTicker.attach(&imu, &SEN10121::filter, imu.dt); //Filter to be called every 50ms to remove accelerometer noise

BATTERY VOLTAGE DECLARATION //Battery Voltage Pinout Declaration #define BATTERY_ANALOG p18 //for monitoring battery voltage //Battery Voltage Declaration AnalogIn batteryVoltage(BATTERY_ANALOG);

BATTERY VOLTAGE FUNCTION float getBatteryVoltage() { return batteryVoltage.read()*3.3*12.6/2.244; //In Volts }

TIMER AND SAFETY DECLARATIONS // Timer & Safety Declarations volatile bool joystickAlive = false; //flag for knowing that the joystick commands are being sent volatile bool safetyBrake = false; //flag for knowing when to engage the safety (disable power to the motors) Ticker safetyBrakeTicker; //Continuous timer interrupt called for safety Ticker robotStatusTicker; //Continuous timer interrupt for sending status messages to the android tablet over UDP volatile bool robotStatusRequested = false; //flag used by robotStatusTicker volatile char status = 0; //status byte for sending robot status to the android app

TIMER (ISR) INITIALIZATIONS safetyBrakeTicker.attach(&safetyBrakeCheck, 0.5); robotStatusTicker.attach(&robotStatusISR, 0.3);

SAFETY BRAKE AND ROBOT STATUS STATEMENTS //SafetyBrake Statements if(safetyBrake) { safetyBrake = false; leftMotor.speed(0.0); rightMotor.speed(0.0); LEDs.setColor(pixel, stopColors, numPixels); } //Robot Status Statements if(robotStatusRequested) { robotStatusRequested = false; sendRobotStatus(); }

SAFETY BRAKE AND ROBOT STATUS FUNCTIONS void safetyBrakeCheck(void) { if(!joystickAlive) safetyBrake = true; else joystickAlive = false; } void sendRobotStatus() { char frame[12]; frame[0] = 0x46; frame[1] = 0x21; *((float*) (frame+2)) = getBatteryVoltage(); *((float*) (frame+6)) = imu.getPitch(); *(frame+10) = status; frame[11] = 0x0A; sendSocket.sendTo(broadcastServer, frame, sizeof(frame)); }

NEOPIXEL LED DECLARATIONS //NeoPixel LED Declarations #define LED_PIN p5 // The pixel array control class. using namespace neopixel; //For neopixel LED Library PixelArray LEDs(LED_PIN); #define numPixels 3 Pixel pixel[numPixels]; //Array of pixel structures holding the colors of each pixel uint8_t stopColors[numPixels*3] = {50,0,0, 50,0,0, 50,0,0}; //RGB colors of the three pixels uint8_t driveColors[numPixels*3] = {0,150,0, 0,150,0, 0,150,0}; uint8_t steerColors[numPixels*3] = {0,0,150, 0,0,150, 0,0,150};

NEOPIXEL LED //Add to openLoop() function if (packetBuffer[1]==127) { if (packetBuffer[4]==127) LEDs.setColor(pixel, stopColors, numPixels); else LEDs.setColor(pixel, steerColors, numPixels); } else LEDs.setColor(pixel, driveColors, numPixels);

ENCODER DECLARATIONS //Motor Encoder Pinout Declarations #define LEFT_CH_A p30 #define LEFT_CH_B p29 #define RIGHT_CH_A p28 #define RIGHT_CH_B p27 //Declaration of the Quadrature Encoders on the two Motors QEI leftEncoder(LEFT_CH_A, LEFT_CH_B, NC, 16, QEI::Encoding); QEI rightEncoder(RIGHT_CH_A, RIGHT_CH_B, NC, 16, QEI::Encoding);

TEAMS MechanicalElectronicsEmbedded Programming Team 1 Bingjie ChenYANG LIUUsman Amin Fiaz Muhammad Akram Karimi Muxingzi Li Team 2 Aaron Sanchez YanezRen LiMartin Velazquez-RizoYazeed AlHarbiJorge Rosas Team 3 Ditho PulunganAyman KaramHassan AlmutawaYomna Al IbrahimHind Alamro Team 4 Mayadah AlhashemAbdullah Alshehri Carmen Leticia Castrejon Barron Sarah AlghamdiNoureddine Toumi Team 5 Mireille HantoucheKhalil MoussiPo-Chun ChenJean LahoudNura Aljaafari Team 6 Zhen JianAbdullah AlmansouriShuai YANGFurrukh SanaRana Al-Rabeh