HOW TO MAKE (ALMOST) ANYTHING

Lily Gabaree

Interface and App Design

This week was overwhelming, because I was out of town for four days visiting family for the Thanksgiving holiday, and I am quite new to app development. My goal was to make an app that launches a rocket onscreen when people shout at the board I made last week. My first challenge was that I had failed to produce regular integers in my serial plotter last week (just hex). I really would like to have something intelligble, both so I can verify the accuracy and responsiveness of the board, and so I can eventually compare numbers from multiple boards in my final project.



First I tried just typing “screen” in terminal (to get what was coming off of the serial port), and got this nonsense:



So clearly I need to do something else to make this input formatted. I recruited my amazing roommate (and software engineer) Matt, because I wasn’t even sure where to start. Matt took a look at the Python code (from Neil’s MEMS board .py file), and suggested some changes to display the input in as integers.



In Python, we are taking serial port data and printing it out as binary. Then Matt filtered out the “11”s, converted the binary value to an integer, and printed the integer values.



We have numbers! They seem to stablize around 140-150 (ambient noise only); we then made an if statement so that it only prints if the value is about 160, which seems to be a decent parameter for shouting.

Now I wanted to pull these values into some kind of web interface. This is where I got really lost. Matt wanted to see if we could replicate what is happening in Python with JavaScript. He was trying to get JavaScript to run the Python script, and pull data from the Python script. Matt has managed to make this readable by humans and then cleared out some empty entries that were showing up. Then, we set it to only trigger for values above 155, and had it print “LOUD NOISE.”



I thought it would be fun to try to get this output to talk to ScratchX, an experimental extension to the Scratch 2.0 platform (so I could finally get a rocket launched on-screen). My coworker Carmelo at Lifelong Kindergarten helped me get set up so that the serial data could be read in ScratchX. This took awhile. First we tried having it read directly into ScratchX, but it didn’t recognize my device. Carmelo did a lot of finangling to get the board to talk to ScratchX, involving running the Python script from Matt's JavaScript app, and then sending the data to a web socket, and then to ScratchX. Once we finally had ScratchX recognizing the device, I made a ScratchX project to launch the rocket when the volume increases above an ambient noise threshold.





Thank you thank you to Matt and Carmelo for all of their help this week!