7

libbybot_eleven/README.md at master · libbymiller/libbybot_eleven · GitHub

 3 years ago
source link: https://github.com/libbymiller/libbybot_eleven/blob/master/pi/README.md
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introduction

The idea is that you run a headless browser on the pi, and connect to it via a laptop or phone using a browser.

You'll need a server to connect to first.

More on how to actually fit it into the lamp, including assembling everything, is in doc.

Installation

This is mostly a matter of making sure the audio and video drivers are in place, and then running chromium on boot, together with a simple python server for controlling the servos.

Set up the Pi with Buster (not Buster-lite)

Here are full instructions for burning an SD card or use Etcher.

When it's done, still with the SD card in the card reader (you may have to unplug the reader / plug it in again), do

touch /Volumes/boot/ssh 

(This is on a Mac; other OS you need to figure out where boot is mounted and create an empty file)

Add in your wifi network creds to /Volumes/boot/wpa_supplicant.conf:

nano /Volumes/boot/wpa_supplicant.conf

contents (the country first line is important, though it doesn't have to be GB, obviously):

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

network={
   ssid="foo"
   psk="bar"
}

or if you're going to move it around, you could try this.

Eject the SD card and put it in a Pi3.

Log in, e.g. by using a screen and keyboard and mouse or by sharing your network over ethernet and sshing in, or sshing in over your network if you added the wpa_supplicant.conf credentials as above.

Add audio and video drivers

sudo nano /etc/modules

contents:

i2c-dev
snd-bcm2835
bcm2835-v4l2

(bcm2835-v4l2 is the V4l2 video drivers for Chromium to pick up the camera; there used to be a bug but not any more)

Enable USB audio

sudo nano /boot/config.txt 

in contents

#dtparam=audio=on ## comment this out
sudo nano /lib/modprobe.d/aliases.conf

in contents

#options snd-usb-audio index=-2 # comment this out

(I find USB audio on the linux / Pi very tricky and I'm not the only one. However, in recent Raspian versions USB audio seems to Just Work. The above is belt and braces. More on linux audio.)

Give the GPU more oomph

This is optional, but you'll get smoother video performance at the cost of the chip getting hotter...! (more info).

Edit config.txt

sudo nano /boot/config.txt  

contents - add or edit:

gpu_mem=192 

Add autostart

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

contents:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
#@v4l2-ctl --set-ctrl=rotate=270 # if you need to rotate the camera picture
@/bin/bash /home/pi/start_chromium.sh

Add the files start_chromium and server.py from this directory into the pi homedirectory. Edit start_chromium.sh to refer to your server.

Make them executable:

chmod a+x start_chromium.sh server.py

install the python server

sudo pip install bottle

enable the camera and serial in interfacing options using

sudo raspi-config

for serial, select 'no' for 'would you like a login shell to be accessible over serial?' and 'yes' to 'Would you like the serial port hardware to be enabled?'

Change the pi name and password

sudo nano /etc/hostname
sudo nano /etc/hosts
passwd

Assemble everything and test

Shutdown and unplug the pi, then -

On your-server, check the logs of server.js and you'll see the number of the room it's connected to.

Connect to https://your-server:8443/remote.html#roomnumber on a laptop, in Chrome or Firefox. You should see whatever the Pi's camera is pointing at, and be able to hear too, and speak.

Longer term, you need to figure out how to do notifications. There's a place in server.js where you can send a dm tweet or a slack notification for example.

More on how to actually fit it into the lamp, including adding the Arduino, is in doc.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK