This is a project I created to keep my son occupied in my study while I work.
The concept is simple, get a raspberri pi, hook it up to old screen, wireless keyboard, mouse and a speaker.
- to change the colour of the screen,
- print the key name,
- say out loud the character
- play music while infractions are happening
- stop music after 10 seconds
- resume music at next contact
I used following as the original idea Original Idea and spent a lot of time stuffing around with Alsa (sound driver) and just ended up using command line tools to do all sounds as it all worked that way.
- create raspberry pi image using provided tools, see download section for this
- configure sound to use headphone jack
- disable all shortcuts in lightdm including how to unmap Alt+Tab which seems to be a special combo (hardcoded)
- auto login with default pi users
- auto run a python application after login
- how to use espeak to speak aloud text
- how to play music using omxplayer
- how to create a GUI app using Tkinter, which was very easy to use mind you
- make a pet project in a hurry
- run OS sub-processes on threads, this is uses to run omxplayer and espeak
- use multi processing with queues
- make classes with functions
- bind to all keyboard and mouse events
- change color of the screen
- use random to select things from array
- do timeouts for operations
- Raspberry PI, something with HDMI and Headphones Jack and a USB power source
- SD Card 8GB
- Speaker and a cable to connect it to your RPI
- A screen, anything will do
- keyboard and mouse, wireless is better
- install.sh - install all dependecies
- watch.sh - wait for app.py to be changed to reload the LightDM
app.py - main app that will run full screen
This process will guide you from very start of setting up your PI to the final outcome.
- Get your Pi setup - here we you will physically use the PI before you resume final config from remote a machine.
- Download the image
- use the Raspberry Pi Imager to write the image to your SD card
- First Boot login with
pi
user and default passwordraspberry
- type
sudo raspi-config
- run
Update
to update Raspi-Config to latest version - go to
Advanced Options > Audio
and choose the audio output for your PI hardware setup, for me its Headphones. - go to
Interfacing Options > SSH
to enable SSH so that you can continue setup from remote. - exit and type
ifconfig
to see what IP you have so that you can connect from remote PC
- run
- From your remote host
- copy your ssh key to the pi using
ssh-copy-id pi@<YOUR PI IP>
- connect via SSH to your pi
ssh pi@<YOUR PI IP
- download all the content from this repo
curl -sSL https://github.com/wildone/childsplay/archive/master.zip > childsplay.zip && unzip -o childsplay.zip && rsync -arctuxz --remove-source-files childsplay-master/* .
- run
bash ./install.sh
- copy your ssh key to the pi using
- create song.mp3 in
music
folder - run
sudo service lightdm restart
or reboot
App uses espeak
and aplay
to speak the key strokes, aplay
is pointed to a device using a APLAY_PARAMS
param you can update these to match your device hardware setup or provide other params
APLAY_PARAMS = "--device=hw:1,0"
To change the greeting name update NAME
param
NAME = "Arkadi"
To change list of songs update MUSIC
list. Currently, only one song is used in a loop, will change this when need comes.
MUSIC = ['song.mp3']
You can run bash upload.sh
on your dev box while you are updating app.py
and it will be uploaded for you to your RPI, update your IP address for RPI in the script.
You can run bash watch.sh
on RPI to monitor your updates to app.py
while you are developing, this will restart LightDM for automatically.
Update host.address
with your ssh connection string.
You can run ./connect.ps1
and a container will be created mapping your ~/.ssh
and connecting you to the host.
You can run ./watch.ps1
and a container will be created mapping your ~/.ssh
and will watch app.py
for updates and will copy then to your host.