may 2018 - draft
Install Pi for Arduino IDE and Visual Micro
1. Download and extract to "mydocuments\Arduino\Hardware". Rename RaspPiArduino-master to piduino.
https://github.com/me-no-dev/RasPiArduino
reminder: "myDocuments\Arduino" is known as the "SketchBook Folder". You might have altered the default location of the SketchBook Folder to another location.
2. Download and install the following toolchain. Install into the following location "myDocuments\Arduino\Hardware\RaspberryPi\piduino\tools\arm-linux-gnueabihf"
https://downloads.raspberrypi.org/raspbian/images/raspbian-2016-09-28/2016-09-23-raspbian-jessie.zip
3. Prepare an SD using the winflash tool below with the Jessie
4. When the Pi boot with a valid SD card prepared in 3) the LED should flash and the Pi should startup.
Useful Tools
http://winflashtool.sysprogs.com/
http://smartty.sysprogs.com/
Instructions for the PI
- Install Raspbian Jessie on your RaspberryPI
- Gain root permissions
- Enable password login for root
- 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
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
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
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