Laundry Alert Log

From ESE205 Wiki
Jump to navigation Jump to search

Week of January 29, 2018

  • Brainstormed ideas for our project and came up with one final idea that we want to go for.
  • Talked about what we want our objectives to be for the project.

Week of February 05, 2018

  • Billy and Young worked on developing a Gantt chart for 40 minutes.
  • Started our project proposal

Challenges for following weeks

  • Learning how to use a Raspberry pi
  • Learning python programming language
  • Learning about Twilio API
  • Finding out which vibration sensors to get
  • Young updated the challenges, and budget section in the project proposal for 40 min

Week of February 12, 2018

  • Billy and Ezra worked on putting together the power point for our project proposal presentation for about an hour.
  • For the coming week, we plan to get started with making the Raspberry pi do some things as suggested by the instructor.
  • Young downloaded raspbian onto the sd card and booted the pi. Had challenges along the way as the raspbian stretch lite download was not working. Tried to use that download method twice. Switch to use the NOOBS download and worked. Tried to set up the ip emailing from a remote desktop to connect to the pi. Code kept failing when creating the /etc/ssmtp/ssmtp.conf document as the pi would not let me save. Also pi would not let me turnoff Sendmail. Worked for about 2 hrs 30 min
  • We had meeting on Tuesday 2/13 for about one and a half hours
  • We divided responsibilities among ourselves, finalized the Gantt chart and the budget.
  • Young continued to work on setting up the Raspberry pi without success. He tried the method from the tutorial again which did not work again. Tried a method using python code and did not work either.
  • Billy and Ezra worked on finishing the powerpoint for the project proposal presentation.
  • Young worked on the pi again for 1 hr and 30 min
  • IP address emailing is working now
  • Tried using the tutorial method again. Each time the raspberry pi boots up, it sends an email that is titled root without the ip address. First thought was that the hash code did not give enough time to the pi to connect to the internet before sending the email. Changed the sleep from 30 to 60 and still didn't work. If the pi couldn't connect to the internet in time in the first place how could it send an email? Hypothesize that the reason it's not working is because I haven't logged in yet from the remote desktop. Tried to find a way to make the pi login automatically remotely from the ssh. Tried using a key. Works for the current ip address of Not sure if it would work with another ip address. Had to use a sudo in the crontab give permission for the code to work. IP emailer works now.

Week of February 19, 2018

  • Thursday 22 30 min

Billy set up a twilio account and made changes to the powerpoint for our project presentation in class per Ellen and Prof. Jim's recommendations.

  • Saturday 24 2 hrs 30 min

All three of us worked on the GPIO pins on the Raspberry Pi. The circuit works using the 3.3V pin and the 5V pin. However, when we use the GPIO pins, the light does not light up. The code works because when we put a print statement into the code printing a 1 when the light is on and a 0 when the light is off it works. The light does not blink. We tried using multiple GPIO pins and multiple configurations of the circuit but it still does not work.

Week of February 26, 2018

  • Challenges

Learning Twilio and how to use it with the Raspberry Pi

  • Monday February 26, 2018 1 hour

Had our weekly meeting with TA and instructor Notes from meeting Blinking LED demo: fixed and working

  • Issue was that you were using GPIO numbering while having the program set to a physical numbering schematic: (appendix 1)
  • Purchase your parts!
  • ADD converter contained
  • Demos for next week:
  • Demo Twilio
  • Demo vibration sensor
  • And if you don’t have your vibration sensor yet, just show us you can read an ADD converter, at at a certain threshold your program does something (like turn on a light)
  • Also by next week: Plan out exactly how your program is going to look
  • The program that will be running the whole time,

Also: how you’re going to connect to a private network?

  • The user interface, web server

If you’re doing a webpage, take a look at building it on an Amazon Web Services EC2 server.

  • Assign someone to be in charge of learning HTML, PHP, etc.

  • Try to put in a lot of hours this week if you can

Parts have been purchased

  • Friday March 2, 2018 Billy 2 hours

In order to start using Twilio, I had to learn the basics about using the python programming language. I spent most of this time downloading and installing the Atom text-editor that works with Python. After that, I did basic a basic test by getting my program to print "Hello World!" It took a lot of time because I was at first unfamiliar with Python and because I could not find out how to change the directory. However, I finally figured it out and got the program to print.

  • Sunday March 4, 2018 Billy 4 hours

Initially, I had successfully sent an sms text to my phone by logging into my twilio account and inserting my phone number. I then started working on sending a SMS message with the help of Twilio using a code provided on the Twilio website. What was challenging was installing The Twilio Python Helper Library. I successfully downloaded the library onto my computer but I could not install it from the Terminal. I tried all three ways explained here: | . I then chose to do it manually but I kept receiving an error "Invalid environment marker: python_version>="3.0"" and I didn't know how to resolve that. Without the library being installed, the code to send a text message to a user using twilio doesn't run as it needs to because it needs to import a file from the library which is why I believe this is the only issue in the way of us sending an sms. As soon the library is installed, the program will be able to send an sms successfully.

  • Sunday March 4, 2018 Young 2 hours

Did research about how to create a web interface. I found this | free QR code generator online. The QR code would then would be put onto the case of the device itself or somewhere on the washing machine. The code would take the user to a website, but question I had was instead could have a number to text on the case instead where it would be connected to the twilio component of the project. When the text message is received from the user, the phone number is sent to a wait room on the website and would also tell the vibration sensor to start sensing. Then the when the vibration sensor senses that the load is done, it would send a signal to the webpage to take the user out of the wait room and also send a text to the user that his/ her laundry is done. For connecting to a private network, School wifi is always connected to pi, but setup and connection to the private network from the pi would be needed to done manually if it is setup in another environment. I think it might be easier to just use the pi instead of a webpage. Amazon EC2 would simplify the process for creating the web interface but would have to add to budget.

  • Sunday March 4, 2018 Young 3 hours 45 minutes

Started to learn how to use the MCP 3008 A/D converter with the potentiometer. When first starting out had to learn why the analog to digital conversion was needed. Figured out that the GPIO pins only take digital input and output and pi does not have a method onboard to convert the signals. Tried to wire the potentiometer without the A/D converter at first and tried to code a voltage barrier that if passed would light an led. It did not work. I then figured out what the A/D converter was used for and tried to wire it up on the breadboard. Figured out a wiring scheme from an | adafruit tutorial but did not have enough wires to configure both the A/D converter and potentiometer onto the breadboard and the pi.

Week of March 5, 2018

  • Monday March 5 Billy, Ezra, Young 1 hour

All three of us met with Ellen and Prof. Feher.

· Got Pi Zero W from Feher · Twilio library issue fixed by installing Python 2.7 · Ezra’s work this week: o W3Schools tutorials, made a “Hello world” type html page. 1 hr of work · 3D print case: o Will be using AutoCAD o What features will you have? · Decided having a website is an unnecessary middleman: will instead use just a self-contained server and have users interact with it by putting the phone number on the side of the device o How else can then user interact (other commands like “stop,” “get wait time,” etc. o Security? Password encrypted? · Private networks: not the most important thing right now, but will likely have to write a program to manually input networks + passwords, then search through it once you leave home. · Focus on getting everything working on the Pi 3 for now, but will likely transfer over to the Zero later.

  • Monday March 5 Billy 30 mins

After our weekly meeting, we realized that the problem with Twilio was the version of python that I was using. I downloaded a lower version and it installed the library successfully. Thereafter, I tried again sending a message to myself and this time it worked. Because I have a trial Twilio account as of now, I am only able to send a message to myself. However, our next step will be to upgrade the account and update our code with the user's number every time we get a new user. Here is a link for the twilio demo: Twilio Demo Also, I had a lot of exams this week. I plan to make up for it next week.

  • Wednesday March 7 Young 3 hours

Watched many videos and demos of how to set up the mcp 3008 a/d converter and tried to wire the converter and the potentiometer to change volume of an mp3 file played on the pi. The wiring configuration was faulty at first and did not work. I tried other configurations of wiring the converter with the potentiometer which also did not work. Decided to instead try the potentiometer with the led lightbulb. The wiring was also faulty which although the potentiometer worked because the values would change when the code would run, the lightbulb would not light up.

  • Thursday March 8 Young 45 min

Tried to figure out the wiring of the led light and ended up successfully getting the led to light up. Here is a link to the potentiometer demo potentiometer demo

Week of March 12, 2018

  • Thursday March 15 Ezra 1 Hour

Watched many videos about learning python

  • Saturday March 17 Ezra 2 Hours

Worked on learning some Python basics; typed out some starter code

Week of March 19, 2018

  • Monday 19, Billy, Young, Ezra 50 minutes

Met with Ellen and Prof. Feher.

  • Tuesday 20, Billy, Young 2 hours

Billy Worked on receiving and replying to sms Messages using Twilio. Following Twilio's guidelines (found here : [1]), I created a very simple web application that is able to accept incoming requests. In order to proceed, I needed to install Flask and setup a virtual development environment. After making sure, the environment was activated, I went on to successfully create a simple file that would run on a local server, which would display a "Hello World!" message when accessed.

According to Twilio's guidelines, the next step was to "build a small Flask application to receive incoming messages. Before we do that, we need to make sure that Twilio can reach your application. Most Twilio services use webhooks to communicate with your application. When Twilio receives an SMS, for example, it reaches out to a URL in your application for instructions on how to handle the message. When you’re working on your Flask application in your development environment, your app is only reachable by other programs on your computer, so Twilio won’t be able to talk to it. We need to solve this problem by making your application accessible over the internet. While there are a lot of ways to do this, like deploying your application to Heroku or AWS, you'll probably want a less laborious way to test your Twilio application. For a lightweight way to make your app available on the internet, we recommend a tool called Ngrok. Once started, Ngrok provides a unique URL on the domain which forwards incoming requests to your local development environment."

I downloaded ngrok witout a problem and it was able to generate a public URL which displayed my "Hello World!" message. However, when it comes to having Twilio send a message back, I keep running in an error and I think the problem lies in the code but I can't quite figure out how to resolve it.

  • Tuesday March 20 Ezra 4 Hours 30 Minutes

Worked on making a starter case for the raspberry pi-0 on SketchUp. I downloaded the needed software for it first. Then I started by making some basic shapes with the help of some helpful videos on it. I then looked up the dimensions of a raspberry pi-0 and saw a couple videos on how to go about making a case to fit these dimensions. After downloading a template, I was able to edit a solid base for the pi case and create a cover for it. A lot of my choices for design were based upon the the dimensions of the pi and were based upon the how the video went about going about it. I curved the edges of the case cover like how the base was curved and made it one mm larger than the base. That way the cover would be removable and the pi can go in and out of it. A screenshot of my starting deign can be found here.

alt text
  • Wednesday March 21 Ezra 2 Hours

I worked on trying to figure out the python code for a priority que implementation. I got an idea of how to do it and what i have to do conceptually but struggled to use Python to actually do it. I was able to find and build basic building blocks of what I need like a basic priority que for integers. But I wasn't able to come to any holistic conclusions just random code and ideas. Still struggling to use python in general as well. Also having problems with user input which is an essential to the code being successful. Hopefully can get it done soon.

  • Thursday March 22 Billy 1 hour

Met with Ellen and, with her help, found out what I was doing wrong. So, basically, I was pasting the wrong URL in the browser. After I changed that, I was able to have twilio send, receive and reply back to messages. The only issue is that ngrok does not allow me to have a static public URL unless I subscribe and pay for it. We might have to consider adding it to the budget. Ellen suggested that I look into AWS. That is going to be the next point of focus.

  • Friday March 23 Ezra 1 hour 30 Minutes

Met with Ellen to help me with the coding. Realized that some of my problems were because I was using an online python website in which user input wasn't working. After transferring to the command prompt on an Engineering computer I was able to use the input. Still need to work on the queue.

  • Friday March 23 Young 1 hour

Researched how to implement twilio into the web server and how to set up twilio on the raspberry pi. Should do something with the ngrok from twilio on the pi.

  • Saturday March 24 Young 1 hour

Researched how to wire the grove vibration sensor to the pi. Most tutorials online use a grove product called the grovepi that is a circuit board that has the grove wires plugging into it which makes it easy to wire the devices into the pi. Also a lot of these projects require or are preferred to be done in javascript instead of python.

  • Sunday March 25 Young 4 hours

Worked on wiring the vibration sensor into the pi gpio pins. Without the grovepi, wiring in the vibration sensor into the pi is very difficult and also very resource intensive using many wires that would take up space and an a/d converter. Also, took a look at the digital vibration sensor. The sensor itself has a potentiometer on it that would allow and adjustable setting for the vibration sensitivity. The sensor is also much smaller than the other setup and with the pi zero in the final build, the device would be small and would easily be put onto a washing machine discretely with a magnet holding it in space. Thought that using this sensor and tuning the sensitivity level to tune out the background noise would work for the project. Wired the sensor to the pi and made a program that everytime the sensor detected movement, it would print a statement saying movement was detected. Also worked on twilio on the pi. Got the pi to be able to send out a message to my phone.

  • Future challenges and things to take into consideration:

Did some research on how to power the pi zero with a battery instead of an outlet. Found many lithium ion packs that are specifically built for the pi. Should be added to the budget.

  • Sunday March 25 Ezra 3 Hours 15 minutes

Worked on a queue able to take in inputs and deliver outputs to a user, some minor faults in it but works overall. Problems occur depending on how many numbers are entered and I think it might be the structure of my while loops and if statements. I might need some help as to how to stop some of these errors but in general everything seems okay. Next step is to finish queue and learn how to incorporate with Twilio and Vibration Sensing.

  • List of functions:

-Able to tell when laundry is done and text user. -Create a queue of users that would tell the next user when the previous user is done. -Let the first user to add a delay timer to the queue before notifying the next user. -Give an estimated wait time for those in the queue for the washing machine.

Week of March 26, 2018

  • Monday March 26 Young, Billy, Ezra 1 hour

Met with Ellen and Prof. Jim.

Demos: Vibration sensor without ADD converter working Twilio autorespond working from computer, not Pi Queue program works

The next steps: -MUST be able to explain how Twilio is able to communicate with the Pi, through the firewall -Start coding for each command -FIRST PRIORITY-- Set up a github for better collaboration -Buy stable URL through ngrok -Incorporate queue of numbers into twilio so that it can send responses to multiple different numbers in order

  • Sunday April 1 Billy

Set up an ngrok account and was able to subscribe to a plan that allows us to retain a public domain. I have been looking into a way to write code for the different commands that our device will be able to operate. Run into multiple issues. I plan to meet with Ellen early next week for help. We were not able to work on putting together Twilio and the queue this week because Ezra was unavailable due to religious reasons. The plan is to have it done by the end of next week.

  • Friday March 27 Young 2 hours

- Wrote a program that would output value of the vibration sensor. The program prints the value of 0 to 1023 depending on the power of the vibration source.

  • Saturday March 28 Young 3 hours

-Tried to use the sensor on a washing machine. Right now with the potentiometer calibrated at where it is at, the vibrations that is outputed by the program are all 1023 if it detects vibration. The washing machine generally does not have many stops in between each step. There are 3 distinct times of stopping which are in between the wash, rinse, and spin parts of the washing process. However, because of where the sensor is calibrated, all of them output 1023 in the program. All that is needed to tell when the washing machine is done is a timer that would timeout after not sensing vibrations for 30 - 60 seconds and would use the program to send a text to the user that the load is done. Also worked on programs for a little.

  • Ezra was out of town most of the week
  • Challenges for next week:

-Being able to have our device respond to different requests from user such as the amount of time remaining, etc. -Have Twilio fully functioning from the Raspberry pi -Incorporate queue of numbers into twilio so that it can send responses to multiple different numbers in order

Week of April 2, 2018

  • Monday April 2 Young 2 hours

Worked on trying to fit twilio in with the priority queue. Putting the fit with twilio should not be hard because of the request form function of twilio allowing the code to take the number that is coming in. However, trying to create the queue with a heap was unsuccessful.

  • Monday April 2 Billy, Young, Ezra 50 mins

Met with Ellen. We mainly talked about the role of ngrok in helping Twilio and the pi communicate.

  • Tuesday April 3 Ezra 1 Hour

-With help from Anthony Sancho, I started the 3D print of the case

  • Thursday April 5 Ezra 1 Hour, Billy Young 2 hours

Ezra Downloaded python and started to install twilio onto his new computer with the help of Billy and Young.

Billy and Young worked on connecting our Twilio account with the raspberry pi in order to be able to send and receive messages. The pi was able to send messages but couldn't yet receive and respond. We followed Twilio's instructions (found here: [2] up until we had to use ngrok. We downloaded ngrok on the pi and then unzipped it. We could not figure out how to have two programs run at the same time on the pi. Also, we could not figure out how to use our reserved domain through ngrok so that ngrok stops randomly generating URLs.

  • Thursday April 5 Young 45 mins

Tried to set up the raspberry pi zero with the stretch lite. The pi works with a monitor and keyboard can't connect to the internet yet.

  • Friday April 6, 2018 Billy 45 mins

Met with Ellen who helped me figure out how to connect our ngrok account to twilio and also how to incorporate our reserved domain into our code. We conducted a test using the new permanent URL provided by our ngrok plan and it was successful.

  • Sunday April 8, 2018, Billy, Young 3 hours

We worked on trying to send a message to twilio and then responding using the pi. We had to first connect to out account using our auth token. Then, we had to call on our reserved domain so that when our program runs, Twilio can access it on the correct URL. This was successful. We can now receive and send texts using our pi with the help of Twilio. Next, we worked on trying to bring our vibration sensing and text sending/receiving programs together. We tried importing one program into another but when we tried running it, we ran into a "500 internal error." We tried different methods that we found here: [3] but none of them worked.

  • Sunday April 8 Ezra 2 Hour

-Finally got twilio working on my own computer to send me a text. Next step is to meet with Billy and Young again about where user input comes into the communication between twilio and the pi. Hopefully once that is understood, I can adjust my que accordingly. Also, I need to meet with Nathan to print another case because I can't seem to find the one I printed before; someone must've picked it up and put it somewhere.

Billy 1 hour
I did more research on how to run a program within another program in python. I tried to combine our vibration sensing program and text sending program. I copied our vibration sensing code and pasted it into the twilio code so that the vibration sensing process would start after the user sends the message "Start" to Twilio. However, I cannot figure out what the error is. Separately, the programs work but combined they do not.

Week of April 9, 2018

  • Monday 9, 2018 Young 1 hour 30 min

Setup the raspberry pi zero to run raspbian and email the ip address. Initial problem was that due to a smaller sd card wanted to use stretch lite but could not connect to the internet using the command line. Switched over to bigger sd card, downloaded raspbian and set it up using the graphical interface.

  • Monday 9, 2018 Ezra, Billy, Young 1 hour

Met with Ellen.

  • Tuesday 10, 2018 Young, Billy 3 hours 45 mins

Worked on the program for the pi. Figured out that because a sleep timer was used in the vibration sensor file, when executed in the texting file, the program would time out. Also had import issues with the code giving us a 500 error.

  • Wednesday 11, 2018 Ezra, Billy, Young 2 hours 45 mins

Met with Ellen in the lab and we tried to work on running our programs at the same time. The issue was that while we were running one program, there was something blocking the continuation of the other program. We looked into threading but still couldn't get it to work.

  • Friday 13, 2018 Billy 2 hours

Kept working on running the two programs: vibration sensing and Twilio to run at the same time without success. Twilio is able to detect the vibration. However, when the timer was involved, it would not work, which presents a major problem because if we don't use the timer our device might send a text message before the laundry is actually done.

  • Saturday 14, 2018 Young 3 Hours

Looked more into delta timing to fix the timing issue that would make the program time out and fail to sent the messages. Found pseudo code for delta timing online and tried to apply that to the pi program. However, did not work.

  • Saturday 14, 2018 Ezra 1 Hour 30 mins

Worked on 3D-model of case. I need to consult with group about whether to close off ports or make room for them, and also need to confirm that we are using pi zero , not 3.

  • Sunday 15, 2018 Billy 3 hours

Met with T.A John Gibson who helped me with threading. The programs seem to work just fine because there is no error anymore but I haven't tested it on an actual laundry machine.

  • Sunday 15, 2018 Young 3 hours

Worked on the code again for the delta timing. Some of the logic was wrong for the delta timing code so I had to slowly debug and find out the problem. Got the delta timing to work but the texts were still failing to send even though the conditions were being met. Figured out that the resp.message() function in twilio times out after 15 secs of first receiving a text when we were trying to send a text after 40 secs. Changed the resp.message() to use a built in method that just directly sends a message after an if condition is met. The basic part but the most important part of the code works now.

alt text
  • Sunday 15, 2018 Ezra, Billy 1 hour 30 mins

We worked on designing the poster.

Week of April 16, 2018

  • Monday April 16, 2018 Ezra 3 Hours 30 mins

Worked on 3D Case, added placements for power sources, for wiring and for the ports we chose to use. Need cover.

alt text
  • Monday April 16, 2018 Young, Ezra, Billy 1 hr

Met with Ellen and Jim. Devised a "path to victory" to see what needed to be done before Friday for a successful demo. Ellen also helped us fix the threading problem that we were experiencing. Apparently all that was needed was a threaded = True at the end of the code.

  • Tuesday April 17, 2018 Young 3 Hours 30 Mins

Met with a TA to learn how to solder. Proceeded to solder the vibration sensor and the MCP 3008 A/D converter to a circuit board. I soldered pins to the pi zero GPIO holes. Lastly, I soldered the connections of the circuit board to the pins of the pi zero. Tested that the pi zero could read the vibration sensor to make sure that the soldered connections all worked.

  • Tuesday April 17, 2018 Ezra 3 Hours

Finished Finalizing 3D case and then sent it to Ellen. Optimized to fit holes and the spacing we needed.

  • Wednesday April 18, 2018 Young 6 Hours 30 Mins

Set up the pi zero to be able to run the program from boot. First had to install twilio and ngrok onto the pi zero. Then I pulled the program files from the repository. Tested that the programs would be able to run and work with vibration sensor and text from twilio. Tried to first use crontab to make the programs run at boot. However, for some reason, even with perfect syntax, the programs would not run at boot. Then tried to use rc.local to run the programs on boot. Also did not work for unknown reasons. Lastly used the .bashrc method to make the programs on boot. This one worked and also would autorun the programs everytime a new device would ssh into the pi. Tried to help Billy debug the queue in the lab. Even though the code looked fine, some of the texts would not send. Worked to debug the code later at night. Figured out the errors that was blocking the code from running was just python syntax errors. First if a variable outside of a function was needed to be used inside a function, the variable had to be declared inside the function as a global variable. Also because in python, functions can not be void, the return statements have to return something, so I just made them return string statements of what each of the functions were doing. Tested the code and the queue was fully functional.

  • Thursday April 19, 2018 Young, Billy, Ezra 4 Hours

Worked on the case first. Because both of the 3D printers went down, we had to find other means to get a case. The cardboard box that the battery for the pi came in seemed to be a good fit. First fitted the battery into the box putting it into the top right corner of the box. One usb port and micro usb port was cut out of the box so that they could be used. The battery was then taped into the box to hold it in place. The pi zero was then placed into the box into the top left corner. Decided it would be best to screw in the pi to the box so it could be removed easily and undamaged. One micro usb port was cut out the box so that the battery could reach the pi. Next the circuit board had to be put into the box. It sat in the bottom right of the box by the battery. A small slit was made at the front of the box so that the vibration sensor could come out of the box. Magnets were then glued onto the bottom of the box. The box was then taped shut. We went through the poster afterwards making sure that we knew how our device worked and that each of us could explain it.

  • Thursday April 19, 2018 Young 2 Hours

Tested the device on a laundry machine. In total tested it on 4 loads of laundry. It worked every single time.

  • Friday April 20, 2018 Young 30 Mins

Calibrated the device so that it would be better suited for the demo. Because a vibration app on the phone was going to be used to simulate a laundry machine vibration for the demo, I re calibrated the vibration sensor so that the max output would be read when it was put against my phone. I also made the delay timer shorter to 20 seconds so that when the vibration stopped, there would be less waiting time to receive texts.

  • Friday April 20, 2018 Young, Ezra, Billy 1 Hour 30 Mins

Demoed our device with our poster.

Link to project page