EPICS on Raspberry-Pi
2017/5/15
M. Iwasaki (Osaka City University)

The original title of this hands-on was “Install EPICS on Raspberry Pi”.
But we only have 1-1.5 hour for this hands on ,and it is impossible to install the EPICS within this session.
(It takes ~1 hour to compile the EPICS etc on RPi.)
 We use the EPICS-installed RPi for the hands-on.
Here you’ll
1) SSH from your note PC to RPi
2) Run the IOC shell on RPi to control the Arduino3) caget / put / monitor from your note PC

Raspberry Pi
The Raspberry Pi (RPi) is a series of small single-board computersdeveloped in the United Kingdom by the Raspberry Pi Foundation
In this hands on, we use RPi3 model B (2016 Feb.)

Raspberry Pi
The Raspberry Pi (RPi) is a series of small single-board computersdeveloped in the United Kingdom by the Raspberry Pi Foundation
In this hands on, we use RPi3 model B (2016 Feb.)- A 1.2GHz 64-bit quad-core ARMv8 CPU- 1GB RAM
Rpi3 controls the device- 802.11n Wireless LAN
via Ethernet, USB, or GPIO.
- Ethernet port
- 4 USB ports
Today we use RPi as an IOC- HDMI port
to control the Arduino via USB.
- 40 GPIO pins, etc,,Tomorrow, there is a talk on GPIO

Arduino
Arduino boards consist of an ATmel 8-bit AVR microcontroller
with varying amounts of flash memory, pins, and features.

Arduino Uno- ATmega328P.
- 14 Digital I/O pins
- 6 Analog inputs- A 16 MHz quartz crystal- 1 USB connection

Arduino
Arduino boards consist of an ATmel 8-bit AVR microcontroller
with varying amounts of flash memory, pins, and features.
DI/DO ports

USB

Arduino Uno- ATmega328P.
- 14 Digital I/O pins
- 6 Analog inputs
AI ports - A 16 MHz quartz crystal- 1 USB connection

Arduino shield(ext. board)
with Bread board for EPICS training
N. Yamamoto (KEK/J-PARC)

Includes1 TriColor LED (RGB)
2 LEDs (Red, Green)
1 Buzzer
1 Push Switch
1 Thermistor
1 CdS (Luminance sensor)
1 level Switch~5,000 JPY
Including Arduino

Arduino sketch file
We use Arduino IDE
to write code (=sketch file), andupload it to the board- Open-source Arduino Software- Runs on Windows, Mac OS X, LinuxThis time we use

Gainermodoki.ino= Sketch file for the Arduino shield(in previous page) for the hands-on
by N.Yamamoto.
Arduino sketch file

/opt/epics/modules/soft/StreamDevice/apps/protocols/gainermodoki/gainermodoki32u/gainermodoki32u.ino

RPi Set Up
What we already did for this hands-on :1. Install OS (raspbian) into RPi
Download the image of 2017-04-10-raspbian-jessie
Copy to the microSD card
2. Install EPICS into RPi
EPICS base, asyn, stream device, etc. under /opt/epics
This time, we install the files compiled by N.Yamamoto.
3. Arduino setup
Install and setup by the command“sudo apt-get install arduino”

RPi Hands On

1. Divide into 5 (or 6) groups
2. SSH to RPi and run the IOC shellIn each group, only 1 person can edit the file and run the IOC shell.

- SSH to RPi (We’ll tell the user/ password / IP address later.)- cd ~/For_HandsOn/scripts- For group 2-6, edit the ArduinoProto.cmd
to change the record name.
From P=myArduuno1,,,To
P=myArduuno*,,, (*=group number, 1-6)
 nano ArduinoProto.cmd- Run the IOC shell./ArduinoProto.cmd(Directory is linked from/opt/epics/modules/soft/StreamDevice/apps/)

RPi Hands On
3. Access the EPICS records from your note PC- caget / camonitor / caput <PV name>- Make the MEDM window to monitor / access the PVs

myArduino*:LUM
Analog Val. From LUM sensor
myArduino*:LED:R
Red LED (=0 Turn On =1 Turn Off)
myArduino*:LED:G
Green LED (=0 Turn On =1 Turn Off)
myArduino*:CLED:R
3-Col. LED Red(=0 Turn On =1 Turn Off)
myArduino*:CLED:G
3-Col. LED Green (=0 Turn On =1 Turn Off)
myArduino*:CLED:B
3-Col. LED Blue (=0 Turn On =1 Turn Off)
myArduino*:buzzer(1: beep sound on)(* = group number, 1-6)