Mobile Platform

Mobile Platform

I've decided to make a mobile platform so i can add sensors to it and program different behaviors, another reason is that one day i want to experiment with robots working and communicating together towards a goal.

Im using processing to communicate between the Xbox pad and the Arduino over bluetooth. Im using Windows XP. Procontrol library can be downloaded here (64 bit version of processing must be used).

Parts list

- Tamiya 70098 universal plate set- £10
- Tamiya track set- £12
- Tamiya 70168 double gearbox kit- £18
- Sainsmart motor shield L298N duel H bridge controller- £13
- Motors (6V)- £4
- Battery packs (9V battery clip, 6V AAA battery pack)- £4
- Bluetooth transceiver- £7
- Arduino mega- £11
- Capacitor 10 micro-farad, 2 X 0.01 micro-farad ceramic cap
-Wire, Solder, Soldering iron, Pliers, Scissors.
- Xbox pad and Xbox receiver for PC (needed to control the robot- a home made control    pad or a software pad could be built)
- Small bread board- £4

    I decided to buy the base instead of home making or 3D printing as this is an exercise in programming, most of the items i bought on amazon.

    Hardware   


    Assembly

    Design

    I came across this tank design whilst researching, i used it because it allows the tank to travel over obstacles, luckily the way i placed the components distributed the weight so that it can go over large obstacles, rock back and forth but not topple over forwards or backwards.

    To get the design i wanted it was trail and error, this configuration will allow the tank to rock back and forth if you want the same design just copy the spacing.

    Side view showing placement of components


    Spacing

    Soldering the motors can be a bit awkward so i used a "third hand" to help. 
    I replaced the stock motors with 6v motors as my motor shield has problems using anything lower than 4.5V, i had problems where only one motor would run.
    Im not going to go into too much detail on how the motor shield works (there's lots of information out there) i attached IN1,IN2 to pins 2,3 on the arduino and IN3,IN4 to 4,5


    i kept everything as symmetrical as possible so the only changes to be made is in the code 

    I put the motors in the same orientation so that it makes things easier when debugging. 
    I also read that adding a capacitor across the motor connections makes them run smoothly.

    The bluetooth module is really easy to use and shows up as a com port. Remember that RX goes to TX and vice versa! its also 3.3v although ive had it connected to 5v once or twice, but having said that after getting it out of storage it would to longer work so ive had to replace it.

    Important! A 10 micro farad capacitor is required between reset and ground on the arduino mega. Otherwise it will keep resetting every time the computer tries to connect.

    Now we have the main body i used a strip of velcro to hold everything on top.




    Software   

    Processing.

    This program must be running to receive values from the Xbox pad then send them to the bluetooths com port. To use the pro control library the 32 bit version of processing must be used. Pin assignments are shown in the arduino code. I'm going to use a set up of sending letters and a number between 0 and 255 from processing (which receives the values from the Xbox pad using the procontroll library) to the arduino which in turn controls the tank.   


    Arduino.

    The arduino receives letters and depending on which moves the motors, forward, backward, left and right. It also receives a set of 3 numbers that controls the amount of power sent to them.


    Troubleshooting

    Bluetooth connectivity

    If processing cant connect to the Bluetooth com port (the bluetooth module led will be solid if connected, blinking if not). First check the cap across reset and ground is there. check the correct comport number by going into devices and printers in control panel and checking the properties, then check we are actually trying to connect to the corresponding port in the list that is printed to processing terminal. eg if its com4 and com 4 is second on the list then you put a 1 between the brackets because the first is actually counted as zero.

    After those steps i usually save and close processing, remove my bluetooth dongle and the BT module then inset the dongle then the BT module then open processing and try again.


    Motors not running or running at different speeds

    Check your soldering is good! also that the battery's are full!

    At the time of writing this my tank still needs calibrating, it starts off with one wheel first then the other gathers speed, the result is you have to turn to get it on course however the tank continues on course..ish! after this first hiccup. Its impossible that these motors will run at the exact same speed therefore if one is running faster than the other code will have to be written to slow it down so they run at approximately the same speed.

    Future additions.

    - Sonar for obstacle avoidance 
    - Room mapping using sonar

    Processing Code, Arduino Code


    Other relevant posts - Bluetooth, Xbox pad

    No comments:

    Post a Comment