Eric Menq Weekly Reports

Eric Menq Status Report for 4/29/2023

This week,  we have been planning and working on how we will demo our project. We have also been working on our report and poster. I am still waiting on the tent to figure out how to set up the motion sensors on it. In the meantime, I have been tinkering with the motion sensors, as when they are performing optimally, they are working above 90% accuracy. However, there are some inconsistencies where the accuracy drops depending on the setup. I found it is likely due to how the sensors are positioned and the aluminum foil we are using to limit their sensing range. I need to fully identify what causes them to mitigate any risks during the demo. I also helped Rong do some load testing on our web application.

This week, I am feeling good about our progress as we wrap up our project. We are waiting for some of the demo materials to arrive, but I feel we are in good shape because I will have more time next week than I had this week to work on the project. Next week, my main focus will be setting up and testing all the devices on the tent we ordered, with a focus on the motion sensors.

Eric Menq Status Report for 4/22/2023

The past 2 weeks, I was able to fix the temperature sensors, and they are successfully sensing and writing to the DynamoDB table via the ESP.  During the debugging process, the first thing I tried was testing every component of the circuit using a voltmeter to make sure everything was powered and connected correctly. Since everything was working properly, I knew it was likely an issue with the software or the sensor itself. Next, I used an oscilloscope to capture what was being sent between the sensor and the ESP. There was some voltage change, but no temperature data was being sent. First I researched more about the ESP pins, since many of them have different capabilities and I fixed issues with the infrared sensors by switching pins. Although many guides recommend pins, most online documentation is for the ESP8266, so I compared the ESP8266 pinout with the ESP32 to identify few pins that would definitely work. This did not immediately fix the issue, so I started looking up any issues other people faced with the DHT. Many ESP users have reported issues with the DHT sensor, so I went though their issues and saw if any were applicable. After testing a few changes unsuccessfully, I found a fix dealing with timing issues of the DHT serial communications. Since this fix was for a different version of the DHT library, I changed the version of my DHT and Adafruit libraries and added the mutex locks to the DHT library to fix the timing issues.

Now that the temperature sensor is working again, I made sure it is still properly populating the DynamoDB table and helped Jay test his script by sending live test data. Similarly, I did the same with the infrared sensors as we continue to fix all our integration bugs/optimize the code. Finally, I assisted Jay in making slides for his presentation next week.

This week, I am still a little behind schedule due to the temperature sensor issues, but Jay and Rong have made good progress with the integration. They were a little bit blocked by my sensor not working, but next week I will be able to fully help with integration. Additionally, we will implement some final optimizations for our algorithm and start planning how we want to do our final presentation.

Eric Menq Status Report for 4/08/2023

This week, with the motion sensors working again, I could start testing the design change of using aluminum foil to block off operating range of the motion sensors. This improved the performance under the situation when people were walking near the door, but as expected, people near the wall where the sensors are pointing can still cause unwanted inputs to the sensor. I will be testing potential design changes for this edge case. However, this week my focus was on the temperature sensor, which also stopped working. I ordered a 5V breadboard power supply module that would provide constant 5V to the breadboard instead of the 3.3V from the ESP. However, the temperature sensor is still not working even when this was integrated. I plan to test the circuit more at school, where I have access to a voltmeter. In the meantime, I have been helping my group test the overall integration of the system, and we have just been inputing dummy temperature data while that situation is being fixed.

This week, I am still behind schedule, but I have allocated extra time next week before Carnival to hopefully get the temperature sensor situation resolved.

So far, I have run comprehensive tests on the infrared motion sensors to make sure they can detect people walking through doors, while not getting false positives from other people near the door. I tested having multiple people walking through to determine how quickly people can consecutively walk through the door such that the sensors are still accurately reporting. I have also run testing to make sure the sensors are sending MTTQ requests to the AWS endpoint, and those messages are being routed to and filling the DynamoDB table. I have also tested the temperature sensor works and does the same process to populate the DynamoDB table, although as previously mentioned, there are issues currently with the temperature sensor.

Eric Menq Status Report for 4/01/2023

This week, I was working with Jay and Rong to integrate the the entire system. I discussed with Jay further on how the script should access the Dynamo DB information, and switched the PK and SK for our Dynamo DB table to make the script more intuitive to implement. I was testing the motion sensors again, and notice an issue where if people are moving near the sensors, it may continuously sense them, blocking its ability to sense people walking through the door. This led to a design change we talk about in the team report. However, while testing this, for some reason, the sensors stopped working completely. To try to fix this, I first made sure it was not the ESP32 by testing its other functionalities still worked. Then, I took two new motion sensors and connected them directly to the board to rule out if it was the sensors or the long extension cables. I double checked the Arduino code to make sure I didn’t accidentally change something and make a mistake. Finally, I completely remade the circuit with a new ESP32 but it still is not working. I am a very confused on why it still does not work, and I will keep working on it tomorrow. In the meantime, for the demo, I if I can not fix the motion sensors, we will demo the temperature sensor to demonstrate all the work we have done with AWS.

This week, I fell behind schedule because I am facing the roadblock with the sensors. Luckily, Jay and Rong made good progress with the script, so I did not have to help with that as much, and I feel we are still in good shape if we can resolve this issue soon. Next week, I will be preparing for the demo and continue to attempt fixing the sensors. If this is accomplished, we can begin our testing and optimization of the entire integrated system.

 

Eric Menq Status Report for 3/25/2023

This week, I worked on fixing my message routing to write to the Dynamo DB table. Eventually, I figured out that the issue was not my message routing rule. I looked into the MTTQ client source code and AWS documentation to figure out the Arudino code needed to pass an additional callback function to the MTQQ client. I also fixed another bug where the ESP would disconnect from the AWS endpoint after a minute, so I wrote code to automatically reconnect as soon as it lost connection. Additionally, me and Jay figured out what fields we want in the DynamoDB table, and how we would communicate the information we needed through the DynamoDB table between sensors and his Python script.

This week, I fell a little bit behind schedule, as I wasn’t able to spend time testing and optimizing the motion sensors. However, this should not take long to do next week, and I will put in a couple extra hours to get this done. Next week, I plan on working with Rong and Jay to our full system integrated so that the WebApp can read sensor data and control the smart plugs. To test this to make sure our system works and determine what we need to improve on next, we will be walking in and out of the room to send occupancy information, and adjusting the room temperature to send temperature data, and testing how the WebApp responds and controls the space heaters.

 

Eric Menq Status Report for 3/18/2023

Last week, I worked on my ethics assignment and made progress with the sensors for our project. First,  I set up and tested our new design by connecting the motion sensors to 3 extended jumper cables that that I put together, then taping the sensors onto the doorframe around torso height. Once this was completed, I finished writing the script for the occupation counter. Specifically, I wrote code that uses the millisDelay library to wait 1.5 seconds after a sensor has gone off, and determine whether the person was walking in or out of the room based on which sensor sent off last. If the ESP receives a sensor input before the timer goes off, it will restart and wait again. Then, I got started on getting the sensors connected to AWS. I wrote Arduino code to connect to our house Wifi, then connect to an AWS endpoint I created through AWS IOT.  From the Arduino side, I used the MQTTclient library to create a client that connects and writes to the AWS endpoint. This process included creating an AWS IOT thing representing our sensors, creating and registering a certificate with AWS Certificate Center, then attaching a policy to the certificate allowing me to connect, publish, and subscribe, to the AWS endpoint. By attaching the certificate, its private key, and the Root CA1 key, I can now connect and make MQTT requests to my AWS endpoint from the ESP32 by sending the certificate with the connection request.. I then created a dynamoDB table, where our software will view and access the sensor data,  and wrote message routing rules to route the MQTT requests to the AWS endpoint to the DynamoDB table.  Finally, me and Jay spent time discussing how we will edit and access the DynamoDB table, as well as our design change to use a intermediary Python script.

This, week I was able to catch back up to my schedule. Since I spent extra time this week, I was hoping to be able to write the DynamoDB table, but I ran into a few issues.  At first, I was using an outdated guide that did not work, and then I had trouble writing the correct policy to attach to my security certificate. Next week, I plan to finish fixing the Arduino code and my AWS message routing rules so that I can write to our DynamoDB table. Once that is finished, I plan on working with Jay to implement the details of our DynamoDB table and how we want to read and write from it. Finally, I want to do additional testing on the sensors to fine tune the measurement parameters I’m using to optimize to sensor performance. For example, I will play around with the delay time after the motion sensor goes off before the code decides whether the person was going in our out of the room. The delay time balances a tradeoff between how quickly people can consecutively enter and how accurate the occupancy counter is when people walk quickly.

Eric Menq Status Report for 3/11/2023

Last week,  I worked with Rong and Jay to write our design review report. We continued to refine our design plan and spent time researching the tradeoffs for some of the more detailed decisions. More specifically, I went to a couple houses on Wilkins and Beeler and looked at the specs of the breaker to get an estimate of the maximum electrical load of off campus housing around CMU. As expected, most houses are on the lower end of what we found online. I used this to get a more accurate calculation for our maximum Watt threshold. Since we want to increase the reliability of our occupancy counter, I also tested different placements of our motion sensors, and modified our design for this purpose. Additionally, I worked on testing our temperature sensors, and used the Arduino code I wrote last week and a traditional thermometer that they meet our accuracy requirements of +-1 degree F sensitivity. I also tested to make sure they were responsive to temperature changes. Finally, I researched how to create a Javascript script to control the sensors, and was able to modify the Arduino code and write a basic script that was successful in wirelessly receiving the sensor outputs on my laptop.

Overall, I am almost completely caught back up to the schedule. The only thing I haven’t completed that we planned is setting up the new design for our motion sensors, which I will do next week, since the ribbon cables just arrived. I will also finish the scripts for the full implementation of the occupancy counter and test that. Hopefully, we will also have time to work together to use the temperature sensor outputs to control the smart plugs as well.

 

 

Eric Menq Status Report for 02/25/2023

This week, I set up the circuits to test our sensors work and can connect to the ESP32s. First, I installed ESP32 in the correct version of the Arduino IDE, as well as the necessary ESP32 USB drivers. I wrote Arduino code, uploaded it to the ESP32, and successfully determined the motion and temperature sensors work to our unit requirements (shown below). Finally, I wrote code to test the ESP32 connection to our Wifi, which will be necessary once the backend of the Web App is set up. I also wrote the Arduino code using 2 infrared sensors to count occupancy, but we want to wait to discuss our physical implementation on Monday before testing that. I am still about half a week behind, since our supplies arrived later in the week, but I was able to do some research on API calls to the ESP32, so integrating our devices with our Web App should go quicker.

left: temp sensor                right: motion sensors

 

Eric Menq Status Report for 02/18/2023

This week, I helped Rong create our design review presentation slides. After realizing that the microcontroller we initially had chosen was sold out, I conducted additional research on an adequate substitute. Rong and I decided to  use the ESP32 for all our sensors after discussing with Will.  I am still waiting for our supplies to arrive, so I helped Jay with the initial set up of our Web application and also started programming the microcontroller code in the Arduino IDE in the meantime. Unfortunately, due to the delay in our supplies’ arrival and the research time that exceeded our expectations, our schedule has been somewhat disrupted. However, I have a good head start on setting up our devices, so it will just take a few extra hours next week to get back on schedule and have the devices set up.

Eric Menq Status Report for 02/11/2023

This week, Rong and I created our proposal presentation slides, and I prepared and gave the presentation. In addition, I contributed to our team’s research on what to purchase for our project. I focused on researching the circuitry to redesign our implementation, based on what is available to purchase. Together with Jay, we have determined the devices we need to purchase.

More specifically, I figured out the constraints we would face if we used an active infrared detector and decided to use a passive infrared motion sensor instead. Since we changed plans, I researched and designed a doorway motion sensor that will use two sensors placed at the door to sense when someone is entering or leaving the room. Via reading the specs, I realized we can determine if someone is entering or leaving by using two sensors, and decided that the best controller for this would be to use a Raspberry Pi. This is because the time frame to detect which motion sensor goes off first will be within a few milliseconds, so we want to mitigate any risk of failed sensing by using a Raspberry Pi, which has a relatively high processing speed. This is an important risk to mitigate since we switched to detecting when people enter and leave rather than if they are in the room at all, so we will need to precisely count how many people are in the room with 100% accuracy. Through researching other Raspberry Pi projects, I also determined we would also need a GPIO connector Ribbon and resistors to complete the circuit. I also found a temperature sensor that is compatible with Arduinos and determined this was the best option since the Arduino would be cheaper and easier to use since we don’t have such a strict time requirement for temperature sensing.

Overall, my progress is on schedule. Next week, I hope to have all the devices set up and working in our testing room, and begin building the circuits to connect them to our microcontrollers.