Serial Communication Simple Application -

This week, I made a simple 3D simulation in p5 to practice the two sides serial communication.

Screenshot 2022-11-08 at 00.44.53.png

IMG_5797.MOV

PCom Serial communication test out 3D physic simulations

In this project, I want to test out the accelerometer on Arduino nano and make p5 read the tilt data. To visualize this, I set up a 3D canvas in p5 and used canon.js as the physic simulation engine.

In this sketch, the angle of inclination of the plane is sync to the Arduino itself. By clicking the button on the Arduino board, user can create new sphere objects in the sketch. In order to visualize the two sides communication, whenever the balls fall from the plane the led on the Arduino blinks. I did not spend much time on the communication and hardware but it took me while to make the tilt mapping to the software correctly.

I found this sketch and interaction can be improved by adding physical feedback other than led blinking since the user’s attention is alway on the screen. The Arduino board works like a game control, using the vibration or sound as the output would make more sense on this application.

Code:

https://github.com/ankycheng/Arduino-p5-Two-Way-Serial-Communication

Reference:

https://docs.arduino.cc/tutorials/nano-33-iot/imu-accelerometer

https://www.alt-codes.net/

https://github.com/schteppe/cannon.js

https://itp.nyu.edu/physcomp/labs/labs-serial-communication/lab-two-way-duplex-webserial-communication/