Skip to content

Setup Development Environment

Meliurwen edited this page May 10, 2018 · 27 revisions

In this tutorial you'll be guided step by step in the building and setup of CoderBot, from ground up to the fully working evironment, directly from source.

It is composed in four "macro-steps": Preparation of the Machine, Preparation of the Environment, Installation of the Core and Configuration. The first macro-step is composed in two mutually exclusive options: Preparation of the Virtual Machine (qemu) and Preparation of the Physical Machine (Raspberry Pi).

Note: The VM option is for testing and development purposes only.

Table of Contents

Preparation of the Machine

Preparation of the Virtual Machine (qemu)

Click here for the tutorial (incomplete at the moment)

Preparation of the Physical Machine (Raspberry Pi)

sudo dd bs=4M if=/dev/mmcblk0 of=2018-04-18-raspbian-stretch-lite.img
nano /media/username/boot/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=IT

network={
    ssid="networkName"
    psk="networkPassword"
    key_mgmt=WPA-PSK
}
touch /media/username/boot/ssh
sudo nano /media/username/rootfs/etc/dhcpcd.conf
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
arp -a
ssh pi@ipAddress -p raspberry

Update Raspbian:

sudo apt update && sudo apt upgrade

Update the Firmware:

sudo apt-get install rpi-update && sudo rpi-update

Enable audio and camera

If /boot/config.txt does not exists:

touch /media/mdog/boot/config.txt

else:

nano /media/mdog/boot/config.txt

Add or, if present, modify these parameters to this:

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Gives 128MB of memory to the GPU
gpu_mem=128

# Enable camera
start_x=1

# Disable camera LED (optional)
#disable_camera_led=1

References:

Check if camera works

With the raspy point the camera to some object and take a picture with the following command:

raspistill -v -o test.jpg

Check if the file test.jpg has been created typing the folowing command:

ls

To be 100% sure that the camera works we have to see the picture we've just shot. We can't do that directly from the terminal, so another option is to download and open it to our main system. On *nix systems:

scp [email protected]:test.jpg ~

On Windows:

pscp.exe username@remoteHost:test.jpg d:\

References:

⚠️ Manca nei repo di stretch il pacchetto gpac

PIGPIO (GPIO daemon)

sudo apt-get install pigpio python-pigpio python3-pigpio

References:

To automate running the daemon at boot time, run:

sudo systemctl enable pigpiod

References:

reboot

Check if pigpiod is running:

sudo service pigpiod status

Audio

Open:

sudo nano /etc/apt/sources.list

Decomment this line:

deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

Update:

sudo apt-get update

References:

Execute:

amixer cset numid=3 1

Edit file asound.conf

sudo nano /etc/asound.conf

add the following:

pcm.!default {
    type hw
    card 0
}
ctl.!default {
    type hw
    card 0
}

Create file /etc/modprobe.d/alsa-base.conf

sudo nano /etc/modprobe.d/alsa-base.conf

With the following content:

options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd_usb_audio,snd_bcm2835

Install pyaudio and espeak (text to speech):

sudo apt-get install python-pyaudio espeak

Reboot and test with this command:

espeak -ven+f3 -k5 -s150 "I've just picked up a fault in the AE35 unit"

Scratch for GPIO

Download and execute the script:

sudo wget http://goo.gl/dANpKr -O isgh.sh && sudo bash isgh.sh

Install Flask

Install picamera, PIL, opencv:

sudo apt-get install python-picamera python-pil python-opencv

Install pip:

sudo apt-get install python-pip

Install Flask:

sudo pip install Flask

Preparation of the Environment

Stuff...

Clone this wiki locally