adityamujumdar / Smart-Dog-Collar-3000

Senior Capstone Project for an IoT device
2 stars 0 forks source link

AutoDoggoMonitoro3000

Senior Capstone Project for an IoT device

Steps Taken on Raspberry Pi

Schematic

Here is the overall schematic for our system (v0.1) alt_text

Setting up Raspberry Pi Zero

Now, do sudo apt-get update to update the OS's dependencies. Then do sudo reboot

For easy access to the Pi, ssh is also setup. In order to setup ssh, complete the following:

alt text

alt_text

Now the Raspberry Pi should be able to accept ssh connections. In order to enable SSH, follow these steps:

Dependency Installation:

sudo apt-get install clang

sudo pip install gps
sudo pip3 install gps

Anti-bark Module

First, connect the audio breakout board, speaker, and microphone as indicated in the schematic

Secondly, we need to edit some config files in the pi before it is able to output audio through the speaker using your favorite editor open the file /boot/config.txt sudo vim /boot/config/txt edit/add the following lines #dtparam=audio=on dtoverlay=hifiberry-dac dtoverlay=i2s-mmap

Next, we want to add a new file /etc/asound.conf

sudo vim /etc/asound.conf and we want to add the following lines:

`pcm.hifiberry { type hw card 0 }

pcm.!default { type plug slave.pcm "dmixer" }

pcm.dmixer { type dmix ipc_key 1024 slave{ pcm "hifiberry" channels 2 } }`

GPS Module

Prerequisites

Next, we will install some dependencies to be able to interact with the GPS module:

Then, we need to enable the serial ports on the Raspberry Pi. With the GPS module plugged in, execute the following command:

sudo raspi-config

alt text

Select Interfacing Options, then Serial

alt_text

Select Finish, then type in sudo reboot to reboot the Raspberry Pi.

Interfacing with GPS Module

Now we can begin interfacing with the GPS Module, and viewing the data it is recieving. Since we are using a Raspberry Pi Zero W, we will be interfacing with the /dev/ttyS0. Other articles mention using /dev/ttyAMA0, however this is only on Raspberry Pi's 1 & 2.

Please NOTE: The following command MUST be executed everytime the Raspberry Pi is restarted

Now the GPS Module should be outputting its data to the Pi. In order to view the data, execute this command:

Accelerometer Module

Prerequisites

With this, the dependencies have been installed.

Check all connections are in place. After running the pedometer/step_counter.py, we get the current temperature and steps taken as output.

Bluetooth Interfacing with Raspberry Pi (Scrapped)

Prerequisites

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install bluetooth blueman bluez

We'll need the Python Library for Bluetooth communication to allow us to send and recieve data

sudo apt-get install python-bluetooth

and we also need the GPIO Library:

sudo apt-get install python-rpi.gpio

RethinkDB Database Setup

Prerequisite (Raspberry Pi Zero)

sudo dphys-swapfile swapoff

sudo nano /etc/dphys-swapfile
    #modify the variable CONF_SWAPSIZE to 1024:
    CONF_SWAPSIZE=1024

sudo dphys-swapfile setup

sudo dphys-swapfile swapon

sudo reboot

Installing RethinkDB (Deprecated - not using)

sudo apt-get install g++ protobuf-compiler libprotobuf-dev libboost-dev curl m4 wget clang

#At this point make sure you check to see that 2.0.4 is still the most recent version of RethinkDB! http://rethinkdb.com

wget https://download.rethinkdb.com/repository/raw/dist/rethinkdb-2.4.1.tgz
tar xf rethinkdb-latest.tgz
rm rethinkdb-latest.tgz
cd rethinkdb-*
./configure --with-system-malloc --allow-fetch 
make

#Export the proper C++ flags for Raspberry Pi 1/2

export CXXFLAGS="-mfpu=neon-vfpv4 -mcpu=native -march=native -mfloat-abi=hard" | make -j3 ALLOW_WARNINGS=1
sudo make install

Print the IP address

_IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi

rethinkdb --bind all --server-name rbpi_rethinkdb -d /home/pi --daemon

exit 0



* Now, to start the 'server' Raspberry Pi, please enter the following command:
`rethinkdb --bind all`

# Installing MongoDB Python Module to Raspberry Pi

To download the python module to use MongoDB on the Client Raspberry Pi, please use the following command:
`sudo pip3 install pymongo`
`sudo pip3 install dnspython`