Learn How To Program Arduino On Raspberry Pi!

Raspberry Pi helps a lot in learning to program. Many people are using it on daily basis to learn Python and C and you can also achieve great results in short period of time using Raspberry Pi. However, when it comes to physical computing and making, Arduino IDE stands on the top of the list.

You can use Raspberry Pi with Arduino components to program the Makeblock robot. This guide will help you in programming controls for robots like Makeblock.

1.Update Raspberry Pi:

It is important that your Raspberry Pi and the firmware powering Pi is always updated. You can setup SD card and perform update. You need to run sudo apt-get update and sudo apt-get upgrade commands to update the Pi.

2. Install Arduino IDE:

Installing Arduino IDE is very important. Arduino IDE is available in Raspbian repositories. You can run the following command to install Arduino IDE –
$ sudo apt-get install arduino

3. Install Arduino Libraries:

You need relevant Arduino libraries to power various Arduino boards. Run the following command to install Arduino libraries –
$ sudo apt-get install avr-libc libftdi1 avrdude openjdk-6-jre librxtx-java

4. Using Arduino:

Now you can start Arduino IDE, you can find it in Electronics section of the programs menu.The sketchbook in home folder holds all your live projects.

5. Makeblock Starter Kit:

You need to understand how Makeblock Programming works before actually programming the robot. You can download the zip file of example code from Github.

6. Install Makeblock Examples:

Look for the sketchbook folder in home directory. Make sure that you have turned off Arduino IDE. Copy the files from the example zip file in new folder inside libraries in sketchbook. You can now install this example code on Arduino.

7. Prepare The Robot:

If you are done with building your robot, remove its battery and plug the control board of robot in Raspberry Pi using microUSB cable. Start the Arduino IDE, go to Tools > Board > Arduino Leonardo and select the serial port.

8. Program Your Robot:

Go to File > Examples > Menu > Makeblock. Click on Starter Kit option and select IR control example. Upload the example to Makeblock and unplug the robot from Raspberry Pi. You will be now able to control the robot using remote controller.

You can modify the example codes to change the controls and functions. The programs are pretty easy to understand and gives clear idea of how these robots and other Arduino devices work.

Add Comment