# vgem

Using the adafruit *MPR121 capacitiv touch sensor* and a *RaspberryPi* to teach some vegetables to speek.

## Requirements

### Hardware

+ [Rraspberrypi](https://www.amazon.de/Raspberry-Pi-Official-Desktop-Starter/dp/B01CI58722/ref=sr_1_5/258-7958823-6093354?ie=UTF8&qid=1549352578&sr=8-5&keywords=raspberrypi) 
+ [MPR121 capacitiv touch sensor](https://www.amazon.de/Adafruit-12-Key-Capacitive-Sensor-Breakout/dp/B00SK8PVNA/ref=sr_1_3?ie=UTF8&qid=1549352918&sr=8-3&keywords=capacitive+touch+sensor) 
+ [extra stuff](https://www.amazon.de/Freenove-Raspberry-Beginner-Processing-Tutorials/dp/B06WD5FTVD/ref=sr_1_3?ie=UTF8&qid=1549353586&sr=8-3&keywords=Freenove+Basic+Starter+Kit)

### Wiring
You need to wire the MPR121 and the LED's as desciped in the [wiring.png](https://git.foxhole.li/moetom/vgem/src/branch/master/wiring.png) and [wiring_sceem.png](https://git.foxhole.li/moetom/vgem/src/branch/master/wiring_sceem.png) file which you can also see below this text. For the LED's we use GPIO 17, 22 and 27, but you can change this easily in the python code on the 'switch' module.

## Installation

First you need to install [Raspbian Stretch](https://www.raspberrypi.org/downloads/raspbian/) by following these [installation guide](https://www.raspberrypi.org/documentation/installation/installing-images/README.md).

### Configure the RaspberryPi

#### Activate *i2c*, *ssh* and *vnc* 
```
    # sudo raspi-config   (5. Interfacing Options)
```

### Install software and dependencies

#### Upgrade packages
```
    # sudo apt update && sudo apt dist-upgrade
```
#### Install *python3* environment, *git* and library for *gpiozero* and *pygame*
```
    # sudo apt install python3 python3-pip git python3-gpiozero python3-pygame
```
#### Install *MPR121* Library
```
    # sudo pip3 install adafruit-circuitpython-mpr121
```
#### Install *Spyder3* (if you like to develop directly on the RaspberryPi's GUI)
```
    # sudo apt install spyder3
```

## Start testing
The basic funktionality of the MPR121 is descriped [here](https://learn.adafruit.com/adafruit-mpr121-12-key-capacitive-touch-sensor-breakout-tutorial/python-circuitpython).

#### Download vgem folder (you need to get an account from Tomás C.)
```
    # git clone https://git.foxhole.li/moetom/vgem.git
```

#### Run *vgem.py* on console or in Spider3
```
    # python3 vgem.py
```
## Wiring pictures
![picture](wiring.png)

![picture](wiring_sceem.png)
