Circulate

by lacoak21 in Circuits > Arduino

249 Views, 0 Favorites, 0 Comments

Circulate

Screen Shot 2021-05-06 at 12.05.46 PM.png

Our project uses an arduino nano 33 iot and wifi controlled light bulbs to create a slow soothing lighting system controlled by user motion.

Supplies

Circulate uses the following materials.

1. Arduino Nano 33 IoT

2. Wifi enabled RGB LED light bulbs

3. Triple-axis Accelerometer and Compass

4. Rechargeable battery pack

5. A PC

6. Access to a 3D printer and printing materials

7.USB

8.Armband

Software Used

The following programs must be installed / downloaded to use Circulate.

1. Arduino and Python can be downloaded from their websites using the links below.

-Arduino -https://www.arduino.cc/en/software

-python -https://www.python.org/downloads/

2. Go to terminal and pip install the following

-pip install urllib

pip3 install flux_led
pip3 install webcolors

3.Make sure to Include the following libraries on arduino by going to Tools -> manage libraries -> search for the library and then click install.

-WIFINina library

-accelerometer library

-magnameter library

-SAMD library

4.Make sure to update Arduino Nano 33 Iot firmware by selecting tools-> wifi101 firmware updater.

Circuit Design

IMG_1037.jpeg
IMG_1039.JPG
IMG_1041.JPG
Screen Shot 2021-05-06 at 11.26.35 AM.png
Screen Shot 2021-05-06 at 12.05.46 PM.png

The first step to wiring the breadboard is to put the accelerometer inside the hand sensor housing. Make sure the hole is big enough to fit 4 wires inside of it. To make sure the hole is large enough, we widened it will an exacto knife. The ground vin, SCL, SDA in pins should have each an arm length wire soldered to it.

Soldering instructions:

-The next step is to attach the wire from ground to the arduino's Ground pin

-The vin wire should be soldered to the 5v, the SCL should be soldered to the A5/SCL pin

-and finally the SDA wire should be soldered to the A4/SDA pin

To test to make sure the accelerometer and magnetometer are working use the following code in an arduino script then load it to the circuit.

/* accel Setup */

while (!Serial) ; // will pause Zero, Leonardo, etc until serial console opens #endif Serial.begin(9600); // Serial.println("Accelerometer Test"); // Serial.println("");

/* Initialise the sensor */ if (!accel.begin()) { /* There was a problem detecting the ADXL345 ... check your connections */ Serial.println("Ooops, no LSM303 detected ... Check your wiring!"); while (1) ; }

/* Mag Setup */
Serial.begin(115200); Serial.println("Magnetometer Test"); Serial.println("");

/* Initialise the sensor */ if (!mag.begin()) { /* There was a problem detecting the LSM303 ... check your connections */ Serial.println("Ooops, no LSM303 detected ... Check your wiring!"); while (1) ; }

3D Print Housing

Screen Shot 2021-04-13 at 10.06.58 AM.png
Screen Shot 2021-04-13 at 10.06.38 AM.png
Screen Shot 2021-04-13 at 10.06.29 AM.png
Screen Shot 2021-04-13 at 10.09.10 AM.png
Screen Shot 2021-04-13 at 10.08.16 AM.png
Screen Shot 2021-05-06 at 11.50.19 AM.png

The two stl files attached should be downloaded onto a flashdrive and uploaded to a 3D print machine. Stay by the printer for at least 30 minutes to make sure that the printing plastic has heated up correctly and that it has started to print without aborting. There was some difficulty printing these two files if the object was transformed but didn't keep the original X,Y and Z ratios. To fix this issue, when transforming the size on Meshmixer, there is a checkbox that should be selected to keep original scaling. The top part of the box may need to be glued to the bottom after soldering. Both holes may need to be enlarged to fix all 4 wires.

Assembly and Operation

IMG_3F026A2DBD0A-3.jpeg
Screen Shot 2021-05-09 at 4.57.56 PM.png

After everything is soldered, The arduino and the battery pack should be put into an armband housing and armband strap so the user can wear it. The accelerometer should already be in the housing.

To run the program follow these steps:

1.Screw the RGB bulbs into the light sockets and plug them into the wall arranging them in the desired way.

2. Connect the PC to the WIFI that will be used and set the #define SECRET_SSID "" and #define SECRET_PASS "" to the name and password of the WIFI in the arduino secrets.h file. If the network has a password, name, and username then the program can not connect to it so a personal hotspot will have to be created. We used an iphone hotspot.

3. Connect the lights to the wifi and calibrate them.Switch each light on and off four times. They should flash blue light to indicate they are in pairing mode. Open the Magic Home app and pair with each light. At this point the lights are ready to be used with the program.

4. Run the python sketch from terminal to open the TCP socket.

5.Plug the arduino nano 33 iot into the PC with a USB and connect the powered off battery to it as well.

6.Compile and upload the sketch to the arduino and it should print to the serial monitor when it does. If it is taking a while to connect or it fails, try turning the hotspot on and off again or reconnect to the wifi. The arduino will not connect unless the PC is also connected to the same WIFI network so double check that as well.

7. When the terminal starts printing data this means that the system is running. Turn the battery pack on and immediately unplug the arduino from the computer. The user can then put the armband on and start the desired activity.

Improvements

Some improvements we have been looking into include creating a faster agent by creating a local network that will only be used for this application. We also are hoping to find a way to incorporate colors as well by potentially finding a new lightbulb library or writing one ourselves.