Week 8: We Struck Gold!

So through the week we talked through more ideas and strategy’s for the bot and looked up motors and wheels we could use, I found this website that sells components and full robots designed for RoboSumo and Mini RoboSumo called FingerTech Robotics. After looking through a a few robots I found a robot that would be suitable for the tournament.
Cobra Mini RoboSumo Bot
This bot was light, fast, had a lot of traction and just fit in the dimension. The only pieces we needed off it though were the wheels and the motors for our design so we went and bought the these wheels here and the motors here. We could choose the gear ratio for the motors which we decided on was 80:1 as we wanted some speed but also have enough torque to push the other bots. So these wheels and motors were perfect for our bot and so we bought one pair of the wheels and two motors.
So in the class I went about remaking the circuit on a new board because the old boards connection rails were exposed and loose which caused bad connections, The other three talked through how the bot would be made like using the laser cutter or cut manually and what materials would be used to make the bot, I would contribute where ever I could while working on the circuit. When I was done making the circuit and everything worked fine we all decided that we would make use of the laser cutter and make the bot out of 3mm acrylic and would have a small metal sheet at the front of the ramp to catch the other bots on the ramp, the bot would be held together by joints, metal brackets and glue.
After that David and I started on testing the range sensor and seeing how accurate it was at measuring distances and what value resistors we should use, Nathan and Sean went about drawing the bot in CAD so the laser cutter could cut it. After connecting the range sensor using the circuit show below:Range Finder CircuitI wrote could code that when the sensor saw an object within a predetermined range, would light up an LED. We set up objects at different distances and test the could with different resistor values while monitoring the voltage given out by the echo pin on the sensor. When testing we noticed that the resistor values didn’t affect the ability to to sense ranges and we just ended up using the 120 ohm as the resistance, the sensor was very accurate at sensing the ranges would light the LED within the few millimeters of the set distance but we noticed that the voltage would occasionally jump to a random value which would give problems later on if the code takes that change and changes state, we used a multimeter for measuring voltage but we found out later that using a oscilloscope would’ve been better to see the false triggers. We also noticed that the sensor was rated for five volts and if we were going to use the 9 volt battery, we would need to drop that voltage using a voltage divider. By this time class was over and we would have the to continue next week and the CAD drawing should be done.

The code for the range sensor is shown below:

<pre>//
// Ultrasonic rangefinder example for MSP430G2553
//
// This program provides a simple example function for reading
// the HC-SR04 ultrasonic rangefinder.
//
// - An LED is driven by P1.0
// - The trigger pulse is sent to the rangefinder via P1.6
// - The echo pulse is read from the rangefinder via P1.7
// - Timer_A1 is used to measure the duration of the echo pulse
//
// Written by Ronan Byrne - last updated 13-3-2015
//
 
#include <msp430.h>
 
int main()
{
    int distance_cm;
     
    // Disable watchdog timer
    WDTCTL = WDTPW + WDTHOLD;
     
    // Make P1.0 a digital output for the LED and P1.6
    // a digital output for the sensor trigger pulses
    P1DIR = 0b01000001;
     
    // Set up Timer_A1: SMCLK clock, input divider=1,
    // "continuous" mode. It counts from 0 to 65535,
    // incrementing once per clock cycle (i.e. every 1us).
    TA1CTL = TASSEL_2 + ID_0 + MC_2;
     
    // Now just monitor distance sensor
    while(1)
    {
        distance_cm = read_distance_sensor_cm();
         
        if (distance_cm < 15)P1OUT |= BIT0; // LED on
        else P1OUT &= ~BIT0;                 // LED off
    }
     
    return 0;
}
 
int read_distance_sensor_cm()
{
    int echo_pulse_duration;      // time in us
    int distance;                 // distance in cm
     
    // Send a 20us trigger pulse
    P1OUT |= BIT6;                // trigger high
    __delay_cycles(20);           // 20us delay
    P1OUT &= ~BIT6;               // trigger low
     
    // Measure duration of echo pulse
    while ((P1IN & BIT7) == 0);   // Wait for start of echo pulse
    TA1R = 0;                     // Reset timer at start of pulse
    while ((P1IN & BIT7) > 0);    // Wait for end of echo pulse
    echo_pulse_duration = TA1R;   // Current timer value is pulse length
    distance = 0.017 * echo_pulse_duration;
    // Convert from us to cm
    return distance;              // Return distance in cm to calling function
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s