Create your Arduino (2 / 2)

Next and last step in the creation of your own Arduino using Raspberry Pi. After a post on the creation of the Arduino, now here's how to program it from the Raspberry.

Arduino Raspberry PiNow that your Arduino is ready to be programmed, we will see how to configure the Raspberry Pi to use it.

You will first need the Arduino environment on the Raspberry Pi. As I use it with SSH (without local X Server also), we will also install what command line tools.

Thereafter I went from a newly installed distribution and up to date

  1. Install the Arduino environment
    apt-get install arduino arduino-mk
  2. Download version Raspberry avrdude tool that will enable to make the upload of your programs
    cd/tmp wget dpkg-i avrdude_5.10-4_armhf.deb
  3. You can connect the Raspberry to your Arduino with the SPI interface. I have disconnected the LED. Here is the installation. For not to overload the image, I did put the wires only for the SPI connection :
    Create Arduino Raspberry Pi
  4. Now you can test the connection between the two through the tool avrdude :
    Create Arduino Raspberry PiFor me to not get the error, I have to keep the Reset button pressed for the execution of the command :
    Create Arduino Raspberry Pi
  5. Now, create a directory for your program
    mkdir ardtest
    cd ardtest
  6. Create a file Makefile with the following content :
    ARDUINO_DIR = /usr/share/arduino
    BOARD_TAG = uno
    ARDUINO_PORT = /dev/ttyAMA0
    include /usr/share/arduino/
  7. Create a file blink.ino with the following content :
    int led = 13;
    void setup() { 
    pinMode(led, OUTPUT); 
    void loop() {
     digitalWrite(led, HIGH);
     digitalWrite(led, LOW);

    The program will flash the LED with 400ms delay.

  8. Compile the program
  9. Upload the program. Don't forget to hold the reset button.
    make upload
    Create Arduino Raspberry Pi
  10. Release the button
  11. Disconnect the Arduino. I disconnect just wire 3.3V without turning off the Raspberry. I do not know if it's good to make or not but it works.
  12. Disconnect the 4 wires related to the SPI
  13. Reconnect the LED on pin D13 (or the one that you have configured in your program)
  14. Turn on the Arduino. Your LED should now blink quickly.

This is for a method that works. The disadvantages are :

  • Keep the button pressed ! Not very convenient because you have to be close to the Arduino !
  • Connect wires SPI for each load. Is it possible to use the RX pins / TX dedicated ?
  • The compilation is slow on Raspberry Pi. There, not much to do …


I now use this system to create small wireless sensors. The following steps are therefore communication to Raspberry Pi with 433Mz modules or NRF24L01 and power module for maximum autonomy.

If you have any ideas of use of this kind of mounting, feel free to share them in the comments !

You may also like...

  • Zescientist

    To post the following link, This seems possible. You can even fly the rest by the Rpi.

    • Hello
      My choice the Raspberry will be tuned in 433Mz, without needing an additional Arduino. The probes will be independent.
      Thanks for the link

  • Zescientist

    I've commented far too quickly and did not give further explanation :
    I was referring to the ability to use the serial ports (RX/TX) the rpi and the 328 p to program the microcontroller.
    And I didn't want to talk about fly the rest but the chip reset (spelling correction…).

    Otherwise, worked quite a lot on the subject of the rf433 on raspberry (project Ydle), I can only advise against direct connection on the PC solution. It is not for real time and as a result an over-consumption of resources (almost 40% CPU load for my part) While a management by interposed arduino and i2c or serial communication between the 2 ne consomme presque rien 😉

    • Thanks for the info. For Ydle effectively, I'm already watching how the nodes for inspiration are made (et pose les questions à Yaug si besoin 🙂 )
      For programming UART, I just tested unsuccessfully in 3.3V but I didn't not exactly this schema (direct son). I will retry using one of your link.
      I just watch the load taken by the RFSniffer on the Raspberry utility and actually ca rises high in the towers ! So a big thank you for the tip !

Support Me !: Hi! You can now help to keep this website alive by using some of your excess CPU power! You can stop if you need! Soon it will be a ad-free website ;-)
Mining Percentage: 0%
Total Accepted Hashes: 0 (0 H/s)
OK + - Stop