My newest update is that I am now able to use GPIO commands to drive 13 solenoids! Here is a video demonstrating a dummy sequence.
https://drive.google.com/file/d/15j3L2sPWW3enOPX8U6tXd_phpCFsdEaZ/view?usp=sharing
And here is the full firmware script I used to do so: https://docs.google.com/document/d/1EplQO1Y9GYS4SYbjHKwGDTp9yScVESmYp59CTWjzwfk/edit?usp=sharing
- Hardware Challenges:
- I spent many, many hours this week getting the solenoid circuitry to work consistently and reliably. Last Friday, it was mostly functional (except for an issue where as solenoids actuating for a while after disconnecting from power). The next time we tried to use our circuit, it was suddenly not working (even though we didn’t change anything on our breadboard). This is because some wires got bent while I placed the breadboard in my bag. Also, I noticed that the tip of the positive terminal wire of one of the solenoids I am using is frayed thus doesn’t adhere to breadboard holes very well- it can slightly shift if I don’t take the routine effort to make sure it is plugged in COMPLETELY.
- The DC power supply I usually use in HHA101 was being used by someone else, so I tried to use an analog DC power supply to input 3.3V into my MOSFET gate. Nothing happened at all and I spent a lot of time debugging the circuit, component-by-component. with an oscilloscope etc. before I thought of testing if this power supply is reliably outputting at all. Using an oscilloscope, I found this power supply was simply broken (it had fluctuating voltages from the scale of microvolts to 1 volt). Ultimately I was able to get back the bench supply I use and know to be functional.
- I tried to use a function generator to apply a square wave gate input but saw that all the BNC connectors required for this were broken
- I realised that if I am not inputting 3.3V into the gate, it still has to be connected to something (ideally ground through a 10K ohm pull-down resistor) to avoid a floating voltage at the gate. This eliminates unreliable operation. Since I am not able to find those resistors today, my workaround was keeping the 3.3V gate input on, while using the 12V power supply to dictate whether the circuit was on or not.
- I moved everything onto the other half of our breadboard in case we caused some damage underneath the breadboard
- Earlier this week, when we realised that our circuit wasn’t working, we tried some troubleshooting. I used a different MOSFET than the one I ordered (one of my partners kept some components after 18100). I realise now this isn’t suitable. This ZVN3306A MOSFET doesn’t fully turn on at 3.3V (it seems it operates in triode mode) and is not built to drive large currents which are critical for activating solenoids. The ZVN3306A MOSFET overheated and there were delays before I realised I should switch back to the IRLZ44NPBF. The IRLZ44NPBF is a logic-level MOSFET which completely allows for saturation operation at a Vgs of 3.3V, whereas the ZVN3306A can require over 4 V.
- Software Challenges:
- The Python MIDI parsing code still needs some debugging to handle chords properly, which has taken longer than expected. I am waiting for Fiona to compose a new midi file and send that to me.
Goals for Next Week
- Hardware Improvements:
- Add pull-down resistors from gate to ground to stabilize the gate input permanently.
- Measure the solenoid current during operation and make sure it is as expected.
- Finish MIDI Parsing:
- Fix any remaining issues with the Python code, especially with the use of chords.
- Make sure the output is formatted correctly so the STM32 can process it. I am thinking of changing my MIDI-parsed output from a string format to a 2d-array to better handle transmitting chord data to the microcontroller (a string would only show every event serially, but for chords we need to portray that some notes play in parallel)
- Work on Firmware:
- Test the STM32 firmware I wrote to handle UART communication and actuate solenoids based on received MIDI data.
- Arrange solenoids on a piano/keyboard and verify that their force when being driven by GPIO signals is adequate to push keys.
- Prepare for Integration:
- After the demo, I must make sure that Fiona’s MIDI-file generation and my MIDI-parsing work together seamlessly and handle all edge cases.