Hardware: Protoptying, schematic design, and PCB layout for 4x4 matrix of RGB LEDs and IR sensors. Code for reading ADCs, fast MOSFET switching, and layout for easy mode creation. Created custom communication bus between ESP and panels. (Daniel)
Coded different visual display/interaction modes, including Rainbow Gradient, Thermal Map, Paint, Negative Paint, etc. (Ryan)
Coded public react app connected to Firebase that sends commands to the ESP to change the mode the panel is displaying. (Jeremy)
Scale and Complexity
While we initially pitched a large scale version of wall art with large 1ft x 1ft "pixels" we quickly realized the sheer complexity and cost of building something like this. Even a small 4x4 matrix is fairly costly, so we decided to consolidate our design into a proof of concept matrix and with our current design, and landed on a 140mm x 140mm matrix.
The current design is tileable with edge connectors, so it is entirely possible to continue building more and adding on to the matrix, it is just cost-prohibitive at the moment with the budget restrictions for this project.
Circuit Design
Prototyping the IR circuit took a very long time. We weren't sure if the IR "receivers" that we had were photodiodes or phototransistors, but once we biased them like phototransistors we got substantially better results.
We still want to increase our sensing range, which is why we have picked one of the most powerful 3mm radial IR LEDs on the market with a typical 200mW/sr radiant intensity. This is an order of magnitude higher than what we propotyped with.
With the 100mA current drawed by the IR LEDs, MOSFETs are required to switch these currents from the arduino pins at rapid speeds. We don't want all the IR LEDs on at once as this would draw unnecessarily large amounts of currents, so we plan to turn each MOSFET (controlling two IR LEDs) on in series after one another at around ~20uS pulse width. This is within spec of the <15nS rise (on) time of the IR LED and MOSFET.
We could pulse the IR LEDs at up to 10A provided the pulse time is less than 20ms, for substantially higher output power.
The 10k resistors originally used in our design limit the voltage we can read from our phototransistors, so we had to switch to 7.8MOhm resistors to produce a large enough voltage out of the phototransistors to be able to sense farther.
After brainstorming the circuit design, and trying various combos of IR LEDs, IR phototransistors, and resistors, we decided on a parts list and began working on the schematic and layout.
The layout of the board is incerdibly complex and is approaching the limits for routing on a 2-layer board. We ended up using every single I/O port of the ATMega32u4, which is not something we expected would happen.
Parsing IR Data
One of the challenging portions was determining how to parse IR phototransistor voltage and convert it into a smoothed signal to turn on our LEDs.
We ended up using the ExponentialFilter library from MegunoLink to heavily smooth the phototransistor readings.
We also take a noise reading 100 times during the bootup of the panel so that the panel has a reference noise voltage that can be eliminated in combination with the aggressive filtering.
We tried using an acrylic diffuser over the panel, both with and without a frosted surface, but found that it prohibited the IR from travelling through it, thus killing our sensing range. We plan to eventually make a 3D printed diffuser that diffuses the LEDs but leaves the IR components exposed.
WiFi Communication
Understanding the HTTP GET request was a necessary part in implementing the control of the LED via WiFi, and was not trivial to find the specific format to be interpreted by the server, and ensure the response was received and correctly processes by the client, with it's asyncronous nature.
Creating the HTML interface required a refresher of the syntax and intricacies of XML, and the interface needed to be able to directly communicate with the LED from the dynamically generated values from the HTTP GET request.
Encountered some difficulty in linking datastreams correctly to components on the Arduino at first when using the Blynk software for an alternative way of interfacing with the LEDs.
Ended up using Firebase for Database and React for a frontend instead. Converted JavaScript code to React for smoother interface, and more responsive webpage. Linked ESP and React webpage to the same Firebase Realtime Database, which allows for exchanging more data between the ESP device and user-interface, and scalability for more robust features and components in the future.
Non-interrupt enabled pins were used for UART ports, so a custom communication bus had to be coded based on signal timing instead of using a known communication protocol like UART or OneWire that require interrupts. This is something that will be fixed in the next design.
The first video is of an IR sensor during prototype phase. The second video is of our completed project.
Daniel plans to continue work on the project over the summer and in the Fall 2023 semester. With support from the CICS Makerspace, he hopes to create a second version of the design with a cheaper microcontroller and lower per-panel cost, and eventually build out a large panel and mount it as permanent art in the LGRC building. The entire project will remain open source and you can check our GitHub (linked at the top of the page) for updates.