torstai 20. maaliskuuta 2014

This blog is telling about my yesterday (19.3.2014) and how it went. I woke up 6.30 am as usual on workdays. Then I dressed and went to eat my normal nourishing breakfast, porridge and a cup of coffee. After finishing my breakfast I washed my teeth, watched tv a few moments, and then left to bus stop by walking. On the way to bus stop I saw and heard many different birds singing and flying around. Bus came on time and was on time at Lapua also. My actual schoolday started with subject called embedded systems at 8 am. There we continued to build and test the Arduino examples. I started to continue from example 10. By that example you can control an electric motor with two pushbuttons. First pushbutton starts and stops the motor and the other one changes direction of the motor. The motor gets operating voltage from 9V battery, because USB port´s voltage (5V) isn´t enought to run the motor. When that example was ready, working and checked by the teacher I continued to next example which was this time example 12, because example 11 was done earlier. Example 12 is about lighting a led with exploiting capacitance. What comes to components it was one of the simplest examples of the Starter kit. One led, two resistors and a couple of jump wires, that´s all. The led light´s when you hold from the jump wire. That´s about the capacitance. Capacitance is the ability of a body to store an electrical charge. Any object that can be electrically charged exhibits capacitance. Example 12 got also accepted by the teacher. After that the morning lessons were almost over and the first coffeebreak was approaching.

Coffeebreak started 9.30 am, as usual. On the time of the coffeebreak we went to Halpa-halli. That´s another usual thing we do on that time a day. After the coffeebreak our schoolday continued with English studies. English started at 10 am. There we learned how to write a CV in English and what you should notice when you write it. We also listened and translated a text chapter into Finnish and did some exercises related to it. In conclution we dealt a exam to next week´s wednesday. The English lessons ended to lunchbreak at 11.30 am. Normally lunchbreak starts at 11 am, but we have decided to complete two lessons at once and start the lunchbreak then.

After the lunchbreak we continued with embedded systems again. The teacher showed how dimmered led looks in oscillosscope and told us how you dimmer led in practise. After that we measured blinking led´s pulse frequency. Then the second coffeebreak started at 1 pm. On that coffeebreak I just browse internet. After the second coffeebreak I began to orient Arduino example number 13. When clock hit to 1.50 pm, I packed my stuff and went to Matkahuolto waiting for the bus as usual. That´s the workdays last bus from Lapua to Kuortane. I left the bus at the same bus stop I come in workday mornings. Then I walked to home.

At home I first brew some coffee and then I heated some food. When I finished my meal and drunk a couple cups of coffee I went to browse internet to my computer. I read some news and reports about what has happened in Finland and worldwide. At 6 pm I went to shop by bicycle. I bought a bottle of drink and then I bicycled back to home. At home I watched tv about an hour or two and then I ate a supper. My usual supper is a couple of sandwitches and a cup of tea. After supper I went to sleep to by bed. That´s how my yesterday went.

torstai 13. maaliskuuta 2014

I decided to use Arduino example code Disco Bot for my embedded systems project. Code will be modified. Disco Bot code plays a melody with the robot, by playing back some sound files. You can choose between three melodies specially composed for the Arduino Robot using the buttons on the control board. If you have uploaded your own sounds to SD card you can also play them by adding to code. Once you get the music you like, put the robot on the floor and it will dance for you. By pressing left/right button you can switch music. If you're not satisfied with the dancing moves, change the example to make it dance differently by modifying the line "Char danceScript []="S4L1R1S2F1B1S1\0". Letters meanings are: S: stop, L: turn left, R: turn right, F: go forward, B: go backwards. The number after each command shows how long it lasts. 1 = 500ms, 2=1000ms, 3=1500ms, and so forth. Heres a video about Arduino Robot with Disco Bot code:





Today (27.3.), I modified the robot´s original danceScript, removed some sound files from the code and switched printed texts to my own texts. I tried to get the robot to make in the shape of square figure. I couldn´t get that exactly right because of many reasons. The main reason was that the robot´s wheels weren´t calibrated wery well. When I put the robot to go forward it tilted to right all the time. Well, the main important was that I got my own texts in to the robot´s screen and playing the sounds that I wanted. I also modified the speed of the robot a little bit slower because the robot hit many times to walls and chairs. After I slowed the speed the robot worked quite well. And finally heres the original part of the code that has not been modified and after that the same part with modified:

|____________________________________________________________________________||                                                                                                                                     |

char danceScript[] = "S4L1R1S2F1B1S1\0";

int currentScript = 0; // what step are we at

int currentSong = 0; // keep track of the current song
static const int SONGS_COUNT = 3; // number of songs

char musics[][11] = {
  "melody.sqm",
  "menu.sqm",
  "chase.sqm",
};

Robot.text("1. Use left and\n right key to switch\n song", 5, 5);
  Robot.text("2. Put robot on the\n ground to dance", 5, 33);

void parseCommand(char dir, char duration) { 
  //convert the scripts to action
  switch(dir) { 
    case 'L':
      Robot.motorsWrite(-255, 255);
      break;
    case 'R':
      Robot.motorsWrite(255, -255);
      break;
    case 'F':
      Robot.motorsWrite(255, 255);
      break;
    case 'B':
      Robot.motorsWrite(-255, -255);
      break;
    case 'S':
      Robot.motorsStop();
      break;
  }

|____________________________________________________________________________||                                                                                                                                     |

char danceScript[] = "S1F2R1B1L1\0";

int currentScript = 0; // what step are we at

int currentSong = 0; // keep track of the current song
static const int SONGS_COUNT = 1; // number of songs

char musics[][11] = {
  "menu.sqm",
};

  Robot.text("Muokattu discobotti", 0, 10);
  Robot.text("Koodi by J-P Keskinen", 0, 20);
  Robot.text("Laita robot lattialle", 0, 30);

void parseCommand(char dir, char duration) {
  //convert the scripts to action
  switch(dir) {
    case 'L':
      Robot.turn(-90);
      delay(1000);
      break;
    case 'R':
      Robot.turn(90);
      delay(1000);
      break;
    case 'F':
      Robot.motorsWrite(150, 150);
      delay(1000);
      break;
    case 'B':
      Robot.motorsWrite(150, 150);
      delay(1000);
      break;
    case 'S':
      Robot.motorsStop();
      break;
  }

|____________________________________________________________________________||                                                                                                                                     |

keskiviikko 19. helmikuuta 2014

This is my first blog on blogger. This blog manages about Arduino robot and my project about it. The Arduino robot has many inputs. Two potentiometers, five buttons, a digital compass, five floor sensors, and an SD card reader. Outputs are speaker, two motors, and a color screen. There are two different boards on the Arduino Robot: the Control Board and the Motor Board. Control board is on top and motor board on bottom. When you set up the robot you must insert the SD card into the slot on the backside of the LCD screen, and then insert the screen into the socket on the control board of the robot. The screen should be connected so that the SD Card is close to the buttons and speaker. The SD card is used for storing information for the robot to read. You can load your own images and sounds to the SD Cards. The Control Board gets the operating voltage from the USB cable that is connected to computer. As an operating voltage of the Motor Board you can use either USB cable or four AA batteries, which have their own place in motor board. It is recommended to use rechargeable batteries. With the USB cable connected you can update either example codes or your own codes to control board if  you have the Arduino program installed in your computer.
The Arduino robot