Geek magazine hacker daily blog

1 year, 9 months ago
It is the shortest history of time of transformation of the robot lawn-mower into the DIY snow blower with management on Bluetooth with phone Android.

As I made the snow blower 3.0 with management on Bluetooth with smartphone Android


It is already the third version of the snow blower. I made the first option of the fighting robot. The second option from a lawn-mower which I prepare for tender. Video with the short presentation of these "products" already was on Geektimes, also in a spoiler in the bottom of a post.

Current construction of the robot very simple. Snow is skimmed by a scraper. The low layer is thrown out from under the snow blower sideways. As the power unit serves the internal combustion engine from the 0.9 h.p. manual lawn-mower. Running engines are a motor reducers from window wipers VAZ. DVS twists the screw. The air flow and mechanical influence of the screw lifts snow from a surface and on an air duct discards aside. The skirt around the snow blower does not allow snow to scatter in the parties. Shurupovanny rubber significantly improves passability of the unit.
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android

Management


Management on Bluetooth with phone Android. Arduino nano+Monster Motor Shield+Bluetooth HC-06
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android
Bluetooth HC-06 works at 3:3é, i.e. it is necessary for the correct work to make conversion of the logic levels. Without it the scheme will work, but there can be problems.
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android
Concerning Monster Motor Shield there are a lot of controversial issues, someone claimed that big percent of defects. This payment very much is pleasant to me because it holds current to 30A.


Arduino


For data acquisition from Bluetooth HC-06 I used Software Serial to leave a possibility of debugging via the terminal on hardware Serial port. It, in particular, was required to trace what data we obtain from Arduino. In the elementary sketch we check acquired character on Bluetooth and we turn on the driver of engines.
Arduino code
#include <SoftwareSerial.h>
#define BRAKEVCC 0
#define CW   1
#define CCW  2
#define BRAKEGND 3
#define CS_THRESHOLD 100

int inApin[2] = {7, 4};  // INA: Clockwise input
int inBpin[2] = {8, 9}; // INB: Counter-clockwise input
int pwmpin[2] = {5, 6}; // PWM input

int statpin = 10;

SoftwareSerial mySerial(2, 3); // RX, TX
char a,b;

void setup()  
{
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


 pinMode(statpin, OUTPUT);

  // Initialize digital pins as outputs
  for (int i=0; i<2; i++)
  {
    pinMode(inApin[i], OUTPUT);
    pinMode(inBpin[i], OUTPUT);
    pinMode(pwmpin[i], OUTPUT);
  }
  // Initialize braked
  for (int i=0; i<2; i++)
  {
    digitalWrite(inApin[i], LOW);
    digitalWrite(inBpin[i], LOW);
  }

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
    digitalWrite(statpin, HIGH);
    
  if (mySerial.available()){
        a=mySerial.read();

    if(a=='F'){
  motorGo(0, CW, 1023);
  motorGo(1, CW, 1023);
    }
    if(a=='B'){
  motorGo(0, CCW, 1023);
  motorGo(1, CCW, 1023);
    }
    if(a=='L'){
  motorGo(0, CW, 1023);
  motorGo(1, CCW, 1023);
    }
    if(a=='R'){
  motorGo(0, CCW, 1023);
  motorGo(1, CW, 1023);
    }
     if(a=='I'){
  motorGo(0, CW, 500);
  motorGo(1, CW, 1023);
    }
    if(a=='G'){
  motorGo(0, CW, 1023);
  motorGo(1, CW, 500);
    }
    if(a=='H'){
  motorGo(0, CCW, 1023);
  motorGo(1, CCW, 500);
    }
    if(a=='J'){
  motorGo(0, CCW, 500);
  motorGo(1, CCW, 1023);
    }
       if(a=='S'){
  motorOff(1);
  motorOff(2);
    }

    Serial.write(a);
    }else{
      
    }
  
}


void motorOff(int motor)
{
  // Initialize braked
  for (int i=0; i<2; i++)
  {
    digitalWrite(inApin[i], LOW);
    digitalWrite(inBpin[i], LOW);
  }
  analogWrite(pwmpin[motor], 0);
}

void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm)
{
  if (motor <= 1)
  {
    if (direct <=4)
    {
      // Set inA[motor]
      if (direct <=1)
        digitalWrite(inApin[motor], HIGH);
      else
        digitalWrite(inApin[motor], LOW);

      // Set inB[motor]
      if ((direct==0)||(direct==2))
        digitalWrite(inBpin[motor], HIGH);
      else
        digitalWrite(inBpin[motor], LOW);

      analogWrite(pwmpin[motor], pwm);
    }
  }
}



Andoid


On Google Play a huge number of ready applications for remote control. From all most of all I liked this application.
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android

Interface
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android
Logic of operation of application
The application sends every second a code of the current combination of pushed buttons by bluetooth.
  • "S" — stop
  • "F" — forward
  • "B" — back
  • "L" — to the left
  • "R" — to the right
  • "I \— forward and to the right
  • "G" — forward and to the left
  • "H" — back and to the right
  • "J" — back and to the left

Management is possible both by means of clicking of keys, and by means of a gyroscope. Functionality of the application rather trivial, but it is enough.

Video




Video Snow blower 1.0 and 2.0
Time goes, and it is necessary to train in control of robots. I decided not to waste time before the following fights of Bronebot and before tender of robots lawn-mowers. I attached a scraper to the fighting robot, worked over increase of friction of wheels, by modification of a protector a little, put a special signal.



P.S.: The following project is the independent underwater robot. I prepare for tender X-Prize. :). Link. It was necessary to save up $2000.
As I made the snow blower 3.0 with management on Bluetooth with smartphone Android
The registration deadline is 30 June, 2016 (11:59 UTC/4:59 PM PST). The registration fee is of $ USD 2,000.00.

This article is a translation of the original post at geektimes.ru/post/268484/
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here: sysmagazine.com@gmail.com.

We believe that the knowledge, which is available at the most popular Russian IT blog geektimes.ru, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.