The Physical folder is the base for all sensing and actuating functions. It holds the two folders - Arduino and Node-Red, as well as the file lcd_display.py, which is used by the Node-Red for LCD outputs.
The Arduino folder holds the two Arduino sketches, one for each Arduino (Arduino 0 and Arduino 1). These Arduino numbers are to be assigned based on the ACM port each Arduino is connected to via USB (ACM0 and ACM1). The Node-Red folder holds the Node-Red flow .json which needs to be manually imported to Node-Red.
## Web ##
This folder holds the logic for the website.
## Database ##
## Setup Instructions ##
#### Prerequisites ####
**Node-Red**
- Install Node-Red with `bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)`.
- On completion, run it with `node-red`. Open the given link for the browser interface.
- Navigate to Settings>Manage Palette.
- Ensure the following packages appear:
-`node-red`
-`node-red-node-serialport`
- If not, search for and install them.
**Arduino IDE**
#### Installation and Configuration ####
1.**Set Up Physical Components:**
-**1x** Raspberry Pi
-**1x** Raspberry Pi GrovePi+ Board
-**2x** Arduino
...
...
@@ -13,42 +46,38 @@
---
# Setup
-**Raspberry Pi:**
- Install **GrovePi+ Board**
-**Pin I2C (any):** V5.0 RGB LCD Screen
-**Ribbon Cable Port:** Pi Camera Module
### Raspberry Pi
1. Install **GrovePi+ Board**
2.**Pin I2C (any):** V5.0 RGB LCD Screen
3.**Ribbon Cable Port:** Pi Camera Module
-**Arduino 0:**
- Install **Grove Hat**
-**Pin D5:** Servo Motor
-**Pin D3:** Button
-**Pin D6:** Button
- Connect to Raspberry Pi using MicroUSB cable (ACM Port 0)
### Arduino 0
1. Install **Grove Hat**
2.**Pin D5:** Servo Motor
3.**Pin D3:** Button
4.**Pin D6:** Button
5. Upload sketch: **`arduino0_motor_button`**
6. Connect to Raspberry Pi using MicroUSB cable (ACM Port 0)
5. Connect to Raspberry Pi using MicroUSB cable (ACM Port 1)
-**Arduino 1:**
- Install **Grove Hat**
-**Pin D5:** Servo Motor
-**Pin D2:** Motion Sensor
- Connect to Raspberry Pi using MicroUSB cable (ACM Port 1)
---
# Node-Red
The system relies on a Node-Red flow, stored in the /physical folder
This will start automatically on running the command ~/cm2305/pi/start.sh, which also runs a virtual environment holding all required libraries
### Required Installs
To install the necessary Node-Red packages:
1. Start Node-Red on the Raspberry Pi by running:
```~/cm2305/pi/start.sh``` or ```node-red```
2. Open the Node-Red browser interface.
3. Navigate to the settings dropdown and click **Manage Palette**.
4. Ensure the following packages are installed:
- `node-red`
- `node-red-node-serialport`
2.**Upload Arduino Sketches with Arduino IDE**
---
\ No newline at end of file
## Running the Project ##
- On the Pi, run `~/cm2305/pi/start.sh`. On running, this should start Node-Red with required libraries.
## Third-Party Software and Frameworks
## Code Documentation
## Troubleshooting ##
### Pi ###
#### Swapped Arduino Functions ####
It's important that the two Arduinos are correctly configured with the right components, sketch, and serial port. If, on monitoring in Node-Red, the Arduinos have swapped functions, it's most likely the serial ports are incorrect. It should be Arduino 0 = ACM0 and Arduino 1 = ACM1. The easiest way to correct this is by unplugging both Arduinos and replugging them, with Arduino 0 being plugged in first.
#### Stranded in Middle of Node-Red Flow ####
If a component is misconfigured and interferes at a point in time after passing the Lock node but not the Unlock node, the system will never reset and won't take accept new inputs. If this happens, stop Node-Red with ctrl+c and re-enter `~/cm2305/pi/start.sh`.