Physical Computing Final
Resources
p5 Web Serial Documentation
Paper Prototypes Planning:
Unsupported Embed
Phase 1: Testing microphone sensor
We considered airflow sensors,
- LRCLK/WS connects to A2 pin on Nano
- BCLK connects to A3 pin on Nano
- Data/SD connects to pin 4 on Nano
Arduino Example Code 1
Arduino Code 2 Working
p5 Web Serial Trial Code
Phase 2: Setting on a concept & planning out layers
Phase 3: Building a Velostat circular mat
Less EMF Paints ArchivesThe original Processing Code for a square grid is as follows below. We figured out we don’t necessarily need to use Processing as that would mean learning Java.
Through the p5 prototyping below, we realised we need around 90 sections (30 below divided by 3, creating 90).
Problem: getting enough pins to connect around 90 sections
- Can we use the I2C bus and an I2C multiplexer for analog signal from copper + velostat? Would the output of I2C communication be helpful in retrieving the range output from the pressure applied on the Velostat?
- It seems like the Arduino Nano only takes 3 multiplexers (3 * 5 wires needed and a max of 19 Arduino pins). For the Sparkfun multiplexer , that would mean 3*16 = 48 regions of sensing, but it’s looking like we need something closer to 90. It’s possible I’m being shortseighted. Would using an array mean we need more connections or less? More actually.
sparkfun SparkFun Analog/Digital MUX Breakout - CD74HC4067
Solution is basically between using an Arduino Mega with 54 pins (16 with PWM) and the Spark Fun or using more I2C multiplexers? [ Question for Prof ]
How to use TX / RX to connect 2 Arduinos:
Class feedback session: Solution
- We’re building a capacitive sensor. // custom pressure sensor.
- When Serial is open, it can’t be open to p5 and TouchDesigner at the same time. There however can be two way serial. There’s also other ways to communicate besides serial - like Midi or OSC.
- Main issue is that 90 is a lot of sections and a lot of code.
- Actually we can use 2 sections ⭕️, making it 32 total or fewer sections in the palm and more in the fingertips = 15 + 30.
- Need to verify this information but the Arduino Mega has no wifi.
- I can chain together the Analog/Digital MUX, which means that the amount of Nano pins wouldn’t be a constraint.
- Sparkfun Analog to digital MUX Multiplexer has a different function than the I2C multiplexer. An I2C multiplexer is for connecting I2C devices that have the same address, so that way you don’t need to change the addresses, you can target the multiplexer instead.
Next steps
Playtest where we have a few sections of the circular sensor working. Visuals can be crappy.
Fabrication
Tools used
- Table Saw to cut up MDF
- Laser Cutter
- Heater for cables
Resources for creating circuit
Multiplexer
Operating Conditions: Supply Voltage Range, Vcc → HC Types 2V to 6V
→ When do we know if we’ve reached the maximum?
🍎 This may be a problem… “Only one of these is selected at any time, based on the control pins.”
How much resistance do resistors need?
To determine the resistance value for your resistor, we need to analyze the circuit and the voltage behavior of the CD74HC4067 in conjunction with the Arduino Nano IoT 33.
Voltage Output on the Channel Pins
The output voltage from any channel pin (e.g., C0) of the CD74HC4067 will depend on the input voltage supplied to the COM (SIG) pin and the control logic state. The multiplexer simply connects the selected channel (C0–C15) to the COM pin with minimal resistance.
- Supply Voltage (VCC):
- Output Impedance:
The CD74HC4067 works with a power supply voltage of 2–6V. If you're powering the board from the Arduino's 3.3V pin, the output voltage on any channel pin will be approximately 3.3V when HIGH.
The ON resistance of the multiplexer (when a channel is active) is around 70–100Ω (depending on VCC). This slight resistance doesn't significantly affect most circuits.
Resistor Calculation for Your Homemade Sensor
For your sensor connected to C0, the resistor to ground is likely acting as a pull-down resistor or forming a voltage divider to measure an analog signal. The resistance value depends on:
- Desired Voltage Range Across the Sensor:
- Sensor Characteristics:
The voltage across the sensor should fall within the Arduino Nano IoT 33's ADC input range (0–3.3V). The ADC has a 12-bit resolution, so you'll get finer measurements if the voltage variation across the sensor spans as much of this range as possible.
What is the expected resistance range of your homemade sensor? This is critical for determining the pull-down resistor.
Case 1: Sensor as a Variable Resistor
Case 2: Fixed Resistor for Digital Input
If your sensor output is binary (e.g., HIGH/LOW detection), use a pull-down resistor:
- Typical values: 10kΩ works well in most cases.
C0 → Sensor → GND (through pull-down resistor).
We have 27 pins left! 🍓
Writing code to read sensors
Moving to VS Code & a React app with p5
Start project with Arduino MKR WiFi 1010 as a replacement for Nano 33 IoT
- First 9 columns (C8 down to C0) from the second multiplexer (D8)
- Next 9 columns (C11 down to C3) from the first multiplexer (A0)
What we did:
- finished hooking up sensors
- Figured out the circuit
- Chained multiplexers
- Added p5 to a React application, started setting up the structure to receive and handle API data for top stories
- Added a way to real serial monitor on VS Code
- Wrote the code for chaining and reading 54 sensors
- Wrote the code to do first baseline readingsz
Feedback from Playtesting #1:
News showing is it bad? Or chaotic? Could show comments instead of news.
Youtube Trending Videos
Visuals:
- can use text for news - text rotating circles like in news channels
Will it be hard to get
Can use felt and
What if we visualize each news story as its own organism?
Play act or
Next week: bring an actual visuals!
Next steps - AI reference advice
Project building: prep for playtest 2
@December 2, 2024
Tasks aren’t building with the same code.
If I reset → unplug → build - monitor doesn’t complete successfully ❌
If I reset without unplugging, monitor reads ✅
But current readings aren’t running.
React can’t read if platformIO is reading.
Print out pics of what’s happening → For interaction.
multiplexee does the same as the for loop
variable resistor = we have an homemade w velostat
there’s a multiplexer library??!
Assumptions: do people understand the touch grass thing? Does the concept make sense.
Make sure to handle cleanup properly in your React component (closing the serial port when the component unmounts)
Debug
- I can list all the ports + select port from the terminal.
- Only one thing can be connected at a time. It’s not broadcasted.
- Don’t get rid of if serial.
- I need I close serial monitor,
- Have p5 send a 0, so that it knows when it’s been pinged. Same as I was sending over
- Mouse press could be the condition and then it reads automatically. Make it user initiated. Don’t do a while loop.
ls /dev/cu.*WebSerial communicates over the browser.
It communicates with the p5.serialcontrol app, a WebSocket server that gives you access to serial devices attached to your computer.
npm npm: @p5-wrapper/reactBasic usage of @p5-wrapper/react
As you work on this any microcontroller-to-computer application, you will be switching back and forth between the app that programs the microcontroller (in this case, the Arduino IDE) and the app that the microcontroller is communicating with (in this case, p5.js in the browser). You have to keep in mind that only one of these at a time can access a serial port.
That means that when you want to reprogram your Arduino from the Arduino IDE, you should to stop your sketch in the browser window to do so. Then, restart the browser sketch when you’re done reprogramming the Arduino. You don’t need to quit the Arduino IDE each time, because it knows to release the serial port when it’s not programming. However, you do need to close the Serial Monitor in the Arduino IDE when you are using WebSerial in the browser.
We changed the Arduino Code to continuously read, but C1 is still off the charts. Is it because electricity takes the path of least resistance?
Code for Ripples on p5 editor - check if flower or ripple output without p5.WebSerial library
Possibility to improve cleanup on React code - not implemented.
For these 3 error messages:
- The RAF (RequestAnimationFrame) violation - this is just a performance warning and not related to our serial connection
- The message port error - this is a Chrome-specific message that's actually not an error, just a notification
- The Bluetooth service message - this is just informing us that AirPods were filtered out of the serial port selection
Playtest #2 Feedback:
- Don’t use real news
- Overwhelming cloud of negative words
- AI generated Gibberish
If you put the installation on the floor people will step on it.
❤️ Grounding ❤️
When you come in, i should
Claspy mechanisms / things
Nasif likes when name contextualizes
Rubbery gas kit - for rubber Talk to phil 2 clasps against each other L brackets
Digital noise that dissipates with collective play
Demo present or video/pics to submit Have people interact Class can go to staging space
ICM Visual Questions:
- Effect of text melting / dissipating into a swirl → into a pond
- setup function in p5 is being fired repeatedly
- Looked into GitHub issues → could be because of States
- I’m also putting the variables in a cleanup function.
- using the updateWithProps p5 react wrapper function.
Solving issue of React re-rendering setup p5 function → switching from state to refs
Key changes
- Replaced all useState with useRef
- Added refs for visualization states (ripples, lotuses, caustics)
- Removed state updates that were causing re-renders
- Used p5Instance.current?.redraw() to trigger redraws only when needed
- Removed dependency array from cleanup useEffect since we're using refs
- Modified all state access to use .current property of refs
The visualization will now update only when new serial data arrives or when explicitly redrawn.
npm npm: p5Connecting all 36 columns x 3 rows = 108 home made FSRs
Fabrication
For the Optoma projector to work, we’d need to raise the structure by 15 inches~
Brooklyn - @glassEagle on ScaniverseAsked AI what the code is doing:
Measurements for final projection surface:
- 27’’ exagerated - any LED panel should have 27’’
- Diagonal: 38.18’’ so 38’’
- 23’’ actual
What’s the maximum dimension that this monitor can have?
I made Raspberry Pi driven large LED matrix with various features : r/raspberry_pi