Murshed J. Ahmed (mja2196 at columbia.edu)
Shijun "Scott" Hou (sh3658 at columbia.edu)
Robert Fea (rf2638 at columbia.edu)
- This project uses a
Raspberry Pi 3 Model B
. - The operating system is
Raspbian
, installed with the NOOBS installer. - An HDMI Cable and HDMI capable monitor is recommended for initial setup and debugging.
- Configure a wireless network connection.
-
Edit the file
/etc/wpa_supplicant/wpa_supplicant.conf
country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="My Unsecured WiFi Network" key_mgmt=NONE }
-
- Generally they can be installed with
sudo pip install package_name_here
- Adafruit packages require manual setup with instructions here.
Package Name Version
----------------- -------
Adafruit-ADXL345 1.0.1
Adafruit-GPIO 1.0.3
Adafruit-PureIO 0.2.1
boto3 1.6.18
botocore 1.9.18
gpiozero 1.4.1
numpy 1.12.1
picamera 1.13
pip 9.0.1
requests 2.18.4
RPi.GPIO 0.6.3
simplejson 3.10.0
urllib3 1.22
weather-api 1.0.2
Can be found after cloning this repository
- Contains deployment pacakge for AWS Lambda function that generates nutrition reports.
- Files in this directory should be imported into AWS Lambda.
- Contains throwaway or one-time use only scripts
- Testing API Calls
- Hardware Interfacing Examples
- Experimenting with component configurations and settings
- Contains proper project source code for running the main program.
src/sensors
contains modules that abstract functionality for sensor inputssrc/output
contains modules that abstract functionality for outputssrc/api
contains modules that interact with third party APIsconfig.txt
should be updated with AWS keys
- Raspberry Pi Board
- Accelerometer
- Camera
- Trash Can
- Breadboard
- Dupont Breadboard Wires
- Board Mounting Plate
- Servo Motors (two)
- Edit the
/etc/rc.local
file to run commands at start up. - You may wish to include one for emailing Raspberry Pi's IP address at boot time
- Assuming you have cloned the repository to
/home/pi/Documents/ican-project
- Add the following line to
/etc/rc.local
to begin executing the main program on boot and dump the output to a file: /usr/bin/python /home/pi/Documents/ican-project/src/ican.py &> /tmp/ican.txt
- Add the following line to
-
Refer to the
src/sensors/lid.py
module. -
Connect the following pins from the Raspberry Pi to the ADXL345 Accelerometer
Raspberry Pi ADXL345 3.3 V 3.3 V GND GND SCL1 (Pin 5) SCL SDA1 (Pin 3) SDA 3.3 V CS GND SDO - INT1 - INT2
-
Look for an LED lighting up when connected.
- Using the ribbon connector tape connector, insert one end to the Pi Camera
- Insert the other end to the Raspberry Pi's Camera port
- This is between the HDMI connector and the audio jack
- Labelled on the PCB as
CAMERA
- This is simply and LED to indicate if the Lid is open or not
- Positive lead goes to Raspberry Pi GPIO 21 (Pin 40)
- Negative lead is connected to a small resistor (approx 100 ohms)
- Resistor is connected in series to common
GND
- Servos are mounted and screwed down on the back of the trash can, using the mounting flanges.
- A wide hole must be drilled for the output axis into the trash can.
- Two flaps made of corrugated plastic sheets must be cut for the trapdoor.
- The
GND
wires of both servos must go to common ground (of the Raspberry Pi) - The
VCC
wires of both servos must go to an external battery source providing approximately 7 volts - The signal wires of each servo must go a GPIO pin on the Raspberry Pi.
- Refer to
src/output/trapdoor.py
. - GPIO 18 (Pin 12) and GPIO 24 (Pin 18)
- Refer to
- Mount the Raspberry Pi, Breadboard, Accelerometer and Camera to Board Holder.
- Screw the Board Holder into the lid of the trash can.
- Insert USB Power Cable through the back of the trash can (or create your own hole).
- Once powered on, the board should begin running the main program.
- You can tell the program is running by the Camera LED being on
- Sign up for a developer account with Nutritionix.
- Replace your API keys in
lambda/nutrition.py
- Sign up for an AWS Account. Free Tier is sufficient.
- Create a Role with Cognito and IAM
- Replace the
COGNITO_ID
insrc/api/aws.py
- In the file
src/config.txt
place your keys from your AWS account.- The values should be one per line
- Account ID
- Identity Pool ID
- Role ARN
- The values should be one per line
- Simply create a new bucket for the project and update the information in
src/api/s3.py
- Create a new classification model in AWS ML
- Use the training data format in
test_scripts/training_data_ican.csv
- Create a realtime endpoint and update the file in
src/api/prediction.py
- Create a new database table
- Update the name in
src/api/database.py
- Create a new topic in SNS.
- Add yourself (your cell phone number) as a subscriber.
- Update the information in
src/api/notification.py
- Create a new Lambda function making sure that it has a role with full access to
- DynamoDB
- SNS
- S3
- Import the deployment package files in the
lambda
directory
- Run the command
feh /path/to/my/image.jpg
- Can also use wildcards to view multiple images
feh pic*
- Would match
pic
,picture
,pic_001
, etc.
- Would match
- Use left/right arrow keys to navigate
- Images are generally loaded in alphabetical order
- Under normal circumstances, with a stable network, the iCan should immediately start running once plugged in
- You can tell the program is running if the red camera light is on and the "Open Indicator" LED responds to movement
- If the program is not running but you know the IP address
- SSH into the Raspberry Pi
- Clear the
/tmp
directory of all text files - Run the main iCan program
python /home/pi/Documents/ican-project/src/ican.py
- If the program is not running and you don't know the IP address
- Connect the portable monitor via HDMI
- Open a terminal and run the same commands above
- Alternatively you can get the IP address of the
wlan0
interface (use the commandifconfig
)- Once you have the IP address you can SSH with the credentials above