Git Product home page Git Product logo

raspiarduino's Introduction

RasPiArduino Build Status

Join the chat at https://gitter.im/me-no-dev/RasPiArduino

Arduino Framework for RaspberryPI

Features

  • The familiar Arduino API
  • pinMode/digitalRead/digitalWrite/analogWrite
  • Full SPI, Wire and Serial compatibility
  • Access to STDIN/STDOUT through the Console class
  • Access to system tty through the TTY library
  • Process, FileIO, Client, Server and UDP implementations through the Bridge library

Instructions for Arduino IDE

  • Open the installation folder of Arduino IDE
  • Create a folder named "RaspberryPi" inside "hardware" and clone the repository to a folder named "piduino"
mkdir hardware/RaspberryPi
cd hardware/RaspberryPi
git clone https://github.com/me-no-dev/RasPiArduino piduino
  • Download , extract and copy the toolchain to piduino/tools/arm-linux-gnueabihf
  • Restart Arduino IDE and select the RaspberryPI from the list of boards
  • Compile a sketch
  • Select the RaspberryPi from the list of Ports (will show the IP address)
  • Upload your sketch and see it go

Instructions for the PI

  • Install Raspbian Jessie on your RaspberryPI
  • Gain root permissions
sudo su
  • Enable password login for root
passwd
  • enter the new root password twice
sed -i "s/PermitRootLogin without-password/PermitRootLogin yes/" /etc/ssh/sshd_config
  • Disable Serial Console on boot by changing /boot/cmdline.txt to
cat > /boot/cmdline.txt <<EOL
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
EOL
  • Disable Serial tty
systemctl disable serial-getty@ttyAMA0
  • Disable loading sound kernel module
sed -i "s/dtparam=audio=on/#dtparam=audio=on/" /boot/config.txt
  • Change the hostname for your Pi (optional)
hostnamectl set-hostname piduino
  • Setup WiFi (optional)
cat > /etc/wpa_supplicant/wpa_supplicant.conf <<EOL
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="your-ssid"
    psk="your-pass"
}
EOL
  • Setup avahi service to allow updating the sketch from ArduinoIDE
cat > /etc/avahi/services/arduino.service <<EOL
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h</name>
  <service>
    <type>_arduino._tcp</type>
    <port>22</port>
    <txt-record>board=bplus</txt-record>
  </service>
</service-group>
EOL

service avahi-daemon restart
  • Install telnet and git
apt-get update
apt-get install telnet git
  • Copy all files from tools/arpi_bins to /usr/local/bin
git clone https://github.com/me-no-dev/RasPiArduino.git piduino
chmod +x piduino/tools/arpi_bins/*
cp piduino/tools/arpi_bins/* /usr/local/bin
rm -rf piduino
  • Create symbolic link for run-avrdude
ln -s /usr/local/bin/run-avrdude /usr/bin/run-avrdude
  • Synchronize time and start sketch on boot (optional)
apt-get install ntpdate
cat > /etc/rc.local <<EOL
#!/bin/sh -e

_IP=\$(hostname -I) || true
if [ "\$_IP" ]; then
  printf "My IP address is %s\n" "\$_IP"
fi

# Sync Time
ntpdate-debian -u > /dev/null
# Start Sketch
/usr/local/bin/run-sketch > /dev/null

exit 0
EOL
  • Prevent some RealTek USB WiFi from sleep (optional) (EU)
echo "options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1" > /etc/modprobe.d/8192cu.conf
echo "options r8188eu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1" > /etc/modprobe.d/r8188eu.conf
  • Disable screen blank (optional)
sed -i "s/BLANK_TIME=30/BLANK_TIME=0/" /etc/kbd/config
sed -i "s/POWERDOWN_TIME=30/POWERDOWN_TIME=0/" /etc/kbd/config
  • Do not load I2C UART or SPI kernel drivers

  • reboot

If everything went well

Selecting the board from the list of ports

Select Pi Port

Password prompt before upload

Enter Pi Pass

Monitoring the sketch

Sketch Monitor

Links to external tutorials

raspiarduino's People

Contributors

me-no-dev avatar nkolban avatar moelski avatar eakoning avatar gitter-badger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.