Probably that will get tiresome after a while, but dang that was a good movie.
And whoo boy after starting looking, I think I might know more about what to do with a severed head than this
Mostly it seems that the MKR Zero uses different libraries and definitions than the nano/e3 so some of the sample code I had been looking at for the VL53L0X won't work without major rewrite. But there's always other sample code.
The box's contents
1 - Arduino MKR Zero (in the end 2 )
1 - MULTICOMP PRO Portable USB High Capacity Power Bank
a whole bunch of WAGO Pluggable Terminal Block
1 - MICROCHIP MCP604-I/P Operational Amplifier
1 - VISHAY Phototransistor
1 - MIDAS OLED Graphic Display
1 - MICROCHIP Temperature Sensor IC
2 - ST Range/Gesture Sensor 53L0-SATEL-I1
I'm not very good at electronics. It's funny, I was going through the early teens at just the wrong time, turned 13 in 1980 I pretty well skipped straight from simple electrical experimentation to computers. Luckily nowadays you can buy component blocks that have the details of "what ohms resistor do I use" or "how many microfarads of a capacitor do I need" already worked out. But I'm pretty rocking at software development, been writing code for 41 years I guess now. Dang I feel old.
The Arduino MKR Zero
It's pretty interesting how many different options there are in Arduinos (as well as the other SBCs/microprocessor boards). The MKR Zero is one of the smallest form factors, energy efficient and has a built in SD card slot. It also has a few neat features not in most other arduino boards.
* There's a connector that meant for connecting a LIPO battery which is handy.
* This board runs on 3.3v instead of 5.
* There's another connector for a second hardware I2C channel. Useful as there are a limited number of pins so in a larger project this really could make a huge difference.
Beyond that, what's supposed to be it's big feature is I2S (Inter-IC Sound). That's an electrical serial bus interface standard for connecting digital audio devices. This allows for the MKR Zero to directly play and analyze music files but that would specifically be .wav files.
Pretty nice overall, handy for portable projects. I killed my first one's USB port by shorting out the USB power pins due to attaching power with it not on a breadboard. There was a pair of pliers on the desk and the pins ended up brushing on it. No problems with the 2nd one outside of what others have noticed - the USB isn't exactly stable on a windows machine. I frequently had to put it into bootloader mode to get it to connect.
Also something new I learned is that you can't have Cura running with the Arduino IDE, even if its set to use Octoprint. Cura appears to scan USB ports and frequently locked the Arduino.
MULTICOMP PRO Portable USB High Capacity Power Bank
A pretty nice power blank. no complexities here. I had considered opening it up to see what it's battery native voltage was (to use plugged directly into the MKR Zero), but it felt unnecessary. Worked nice overall.
WAGO Pluggable Terminal Blocks
I had never looked at these before, but they are pretty cool. they come in various configurations of how many wires connect together, and then each module can click into a variety of holders they have. For this project they'll get used for the AC power coming into the box.
MICROCHIP MCP604-I/P Operational Amplifier
Given my lack of great electronics knowledge, i wasn't totally sure on what to use this for. I understand the general use, but the devil is in the details. Plan for it is to use it with the phototransistor to help buffer it to giving a true on/off signal.
This I went back and forth with, partially due to my difficulty with getting a straightforward open/closed signal from it. For this project, plan was to have it be a safety interlock, shutting off the circuit if the box is opened.
MIDAS OLED Graphic Display
I was surprised at how small this was. Still quite a nice display, and Adafruit has some simple libraries that work really well.
MICROCHIP Temperature Sensor IC
Nice, small, easy to work with. It's downside is that its not a fast temperature sensor. It takes a second or two for it to update. Also, it appears to have a really fine measurement capability, but at the same time it appears to vary a bit (within 0.1 degrees though).
And the fun part, that really drove the thought process for me
ST Range/Gesture Sensor 53L0-SATEL-I1
These are pretty neat. Basically a LIDAR unit. These are configured to be used with ST's Nucleo development board, and their documentation is a little spotty if you're planning on using it as the whole satellite board without the Nucleo. They are breakoff boards, so you can bust it down to just the VL53L0X piece but then you need some other components. Also, part of the challenge with this was that the ST libraries didn't cooperate with the MKR Zero, as its a SAM-D board. There's some differences in the dependent libraries like Wire which added to the challenge. ST has an example with gesture recognition that I was never able to get working. In the end it was ok, it was still easy to get the distance measurements from the chips which was all I really needed.
I started off with a variety of ideas, but ended up with something my wife came up with. She showed me a video of someone using Alexa to control a sewing machine's speed and that started it off.
The core concept is helping someone who has difficulty with using a foot/knee pedal consistently to use hand gestures instead. The gesture sensors will catch the gesture, the temperature sensor would be attached to the sewing machine motor, and both the power level and temperature would be displayed on the OLED. The phototransistor would as mentioned above act as a safety interlock, shutting everything down if the box is opened as it will have live 110 AC. The power bank would power the arduino so there's no need to use a wall wart or other transformer with it.
I started with trying to wire up a triac myself, but realized I didn't have an appropriate transformer so wasn't going to be able to do a decent zero detect. So I ended up ordering a dimmer board meant to use with an Arduino. I also got an I2C multiplexer to make interfacing the gesture sensors a little easier.
It didn't reach completion in time, but I will still finish it. I ran into a variety of issues over the project. Shorting out the first MKR was one. Another issue was the number of components. I got to running out of pins on the Arduino. Related to that, although some pins are programmable, some are not. So trying to get it all working together took a bit of shuffling around. In the end I couldn't manage to get the zero detect and interrupts with the dimmer working along with everything else. Their library I couldn't get to work at all, but found some more direct code that worked when the only thing connected to the arduino was the dimmer. with everything connected it never worked out. That also could be from the code however as using the PWM based on zero cross is pretty timing specific. It happens every 166 milliseconds, so any delays would throw it off.
But here's a video with most of the rest of it working!
The rest of the journey is documented below. It was fun getting here, and painting the sewing machine was a lot of fun too.