Raspberri Pi and Arduino

fukurou

the supreme coder
ADMIN
:s18:when manipulating hardware:
  • power off everything before
  • correctly power off the Raspberry Pi
 

fukurou

the supreme coder
ADMIN
warnings
when manipulating Raspberry Pi, always:
1 shutdown the Pi from the desktop
2 wait 20 seconds and remove the power cable
 
Last edited:

fukurou

the supreme coder
ADMIN
Pi OS installation aka SD card flashing

1 https://www.raspberrypi.com/software/

Download and install Raspberry Pi Imager to a computer with an SD card reader.
Put the SD card you'll use with your Raspberry Pi into the reader and run Raspberry Pi
Imager.

this software will flash the raspberry OS into your SD card.
the software should be at least 1.7.2 for pi 4

2 connect the SD card to your computer, click choose Operating System and pick the
latest one.
click choose storage, and it should detect your SD card.

click setting and configure:
check enable SSH, use password auth.
(this will enable to access remotely (using the terminal) to the Pi,
without an external monitor)

and set a username and password.

on "configure wireless LAN": add the name and pass for your Wi-Fi network
(internet router)

on "set local settings": set your time zone and keyboard language.

click on save

3 click on write, yes.
 

fukurou

the supreme coder
ADMIN
booting the Pi

make sure the power is off and no cables are connected.

plug in the SD card into the Pi.
connect the Pi to a power supply (not computer USB cable)

the green LED should blink randomly, meaning the Pi is booting.
a few seconds later the Pi will have connected to the WiFi network.
 

fukurou

the supreme coder
ADMIN
finding the Pi IP address

Angry IP Scanner - the original IP scanner for Windows, Mac and Linux

The original IP scanner for Windows, Max and Linux. Fast, friendly, extensible, free and open-source. Scans addresses and ports in any range and exports results in many formats.
angryip.org
go to downloads and choose your computers OS.
install angry IP scanner.

assuming your computer is connected to the same WiFi network,
in the angry IP scanner:
click on the icon next to start and add MAC vendor.

click IP and find a line that has wifi 192.168 or 10.0 and click it
so the IP range shows something like
192.168.31.0 to 192.168.31.255
edit the final numbers to 0 and 255 if they aren't set that way already.

click start, and wait about a minute.
if fire wall pops up, click allow.
click ping, sort by ping.
the blue circles mark findings, red mark no findings
you should see a blue dot and raspberry pi.local under host name, and the pi IP address.
 
Last edited:

fukurou

the supreme coder
ADMIN
VNC

it enables work with the Pi after SSH connection has been established from the computer.
on terminal after ssh pi@ip_address

// if you need to exit the SSH connection use the command exit

sudo raspi-config
choose interface options, VNC, would you like VNC to be enabled?, yes
finish.

back on the terminal reboot the Pi:
sudo reboot

should say connection reset
wait 1 minute

ssh pi@ip_address
sudo raspi-config
// enable VNC:
system options, boot / auto login, desktop autologin, finish, reboot now? yes

should say connection reset on the terminal
wait 1 minute

ssh pi@ip_address
sudo raspi-config

display options, VNC resolution, chose the resolution of your computer screen
1920x1080 for full HD, finish, reboot now? yes.

get VNC at
www.realvnc.com

Download VNC Viewer | VNC® Connect

Control VNC® enabled computers with VNC® Viewer.
www.realvnc.com
www.realvnc.com
choose your computer OS

this is how you will connect to the Pi moving forward(post installation stage)
on VNC:
file, new connection,
VNC server : ip address of the Pi
name : does not matter
click ok, click Raspberry Pi, configure, enter the user name and pass of the PI
from the SD flash stage.

on VNC configurations

APPEARANCE:
raspberry Pi icon, preferences, appearance settings, task bar, very large,
system, font, set font size.

raspberry Pi icon, preferences, raspberry Pi configurations:
system, password : you can change the password, than reboot to apply.

on display you can change the resolution on VNC.

interfaces: from here you can enable SSH, VNC

localization: set timezone and keyboard language.

from the tool bar you can change wifi network, but than you will need to
find the new IP address on your computer that should be connected to the new wifi network.
than connect via SSH or VNC to the Pi.

click the update icon left of the bluetooth icon to update the Pi software, install updates.

powering off the Pi

menu (upper tool bar), Pi symbol, shutdown, wait a minute, now you can remove the power supply.

to power on make sure the SD card is in, then connect the power supply cable.
 
Last edited:

fukurou

the supreme coder
ADMIN
change Pi wifi settings

assuming your computer now uses a different wifi network
than the one in thePi settings.

power off the Pi, connect the SD card to your computer.
the SD card should have the name boot.

add a new file to config the wifi:

new text document, wpa_supplicant.conf

file contents:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="your_wifi_ssid"
psk="your_wifi_password"
}

ssid will be the wifi network name
psk will be the wifi network password

connect the SD card to the off powered Pi, turn on the Pi, wait a minute
open angry IP scanner to find the new Pi IP.
VNC, right click Raspberry PI, properties, update the new IP address, double click to connect.
 

fukurou

the supreme coder
ADMIN
install Arduino IDE on the Raspberry Pi

open web browser on the Pi and type Arduino IDE
Arduino IDE, https://www.arduino.cc/en/software,

check your OS:
terminal->
uname -m

armv7l = arm 32 bit OS
x 86 64 = 64 bit OS

chose the corresponding download.

terminal:
cd Downloads/
ls
// extract:
tar -xf arduino-1.8.16-linuxarm.tar.xz
ls
// move the IDE to opt dir:
sudo mv arduino-1.8.16 /opt/
cd /opt/
ls
cd arduino-1.8.16/
ls
sudo ./install.sh
// wait

:s42:note: to uninstall go to
/opt/arduino-1.8.16
and run the uninstall.sh script, then remove the /opt/arduino-1.8.16 folder as well.


arduino IDE on Pi.png
on the Arduino IDE:
check : display line numbers, set font size

file, preferences, choose a folder to store your audrino sketches (.ino files)
(sketch book location).
and check the verify code option on.

config preferences file:
/home/pi/arduino15/preferences.txt (click from the preferences window)

close the arduino IDE, before editing preferences.txt.
edit Monofont, plain, 14
to Consolas, plain, 14
ctrl+s

connection.png

compile test:
tools, board, Arduino uno (your model board)
tools, port, ttyACM0(Arduino uno)

run the code to verify connection.
 
Top