Created using Arduino, C, and Adobe Illustrator
An installation perceived data from YYZ airport departures, controlling three hairdryers to melt crayons by Arduino and p5.js.
Group members: Yiyi Shao, Feng Yuan, Jad Rabbaa
My responsibilities: concept developing, coding
We aim to turn pollutions into a piece of artwork and to promote this message to people who travel a lot to do more in daily life to set off their carbon prints.
THE PROBLEMS WE FACED:
1. Design an ending for reading the data. Since we currently using a manually json data which only contain 2~3 hours flight datas, we decide a ending for reading the data which will let us and the audience know “here is the ending of the datas.” Using the below function to know the length of the data array. This callback function will only run at the first time the json file be read.
2. Read the json from server. Our original plan was putting the json file in webspace server. However, on the day we did the final testing, the server we used was block for some system maintain issues( not sure ). Then we decided to create a js file (DATA.js) to storage all the json datas.
3. Send Data: It’s time to connect p5.js to arduino, we used a bridge called p5.serialcontrol to send data to serial port so arduino can read it and write to relevant pins. At the beginning, p5.js just read from the json file and send outbyte to serial port. We sense that will give us trouble so we simply compared the data within p5.js and directly send four numbers to arduino. We tested it when reading json file that been put on webspace, which works perfectly fine.
But after we decided to work on local data file we faced some weird problems. When reconnecting the p5.js to arduino, suddenly it’s just not working. We spent a whole afternoon troubleshooting. Initially we thought it’s the problem from p5.js after we wrote some new code to read Data.js as arrays, so we console log out all the number and data types and found there shouldn’t be an issue. Then we commented out all the data but just sent a simple “1” to the serial port in the draw function, interestingly arduino couldn't even read that simple command. So we found an example code from p5.serialcontrol that we know which will definitely work to test with arduino. And…. it works. So we replaced both the arduino code and p5.js code to test with ours to see which part is causing problem. Then we found that probably the differences between digitalwrite and analogwrite in arduino, which obviously make no sense. However, it did only work in analogwrite for some reason. We re-started our laptop and took a deep breath and hope everything become normal. And… it still doesn’t work. Another one hour past, here we come the magical moment, we used another usb cable for arduino board, everything turned out to work! Hallelujah! What a typical day to dealing with digital components.