Electronics Manufacturing
This project had more complexity than previous weekly assignments:
- Controlling (and powering up) 5 small servos (5V each)
- Reading input from (and powering up) a commercial coin acceptor component (12V)
- Having a full UI with a touchscreen
- RaspberryPi (USB Power)
- Touchscreen (USB Power)
- Coordinating all the components from a custom-made board, and managing their power needs accordingly
- Using a microcontroller from the SAMD11xxxx family (3.3V)
This required a board that could manage these devices both from a power management point, and from a number-of-peripherals perspective.
Power management
Most of the components for this project would be powered by an old 12V power supply that was around the lab, so the board included two voltage regulators in order to be able to output all of the voltages needed (12V for the coin acceptor, 5V for the servos and 3V3 for the microcontroller)
One of the initial fears was if it would be an issue to try to use/program the board over USB, or if Serial console would work if the programming computer did not detect any power being consumed over the USB port.
That turned out not to be a problem, and the board ended up working properly (Serial comms worked, etc..) and there were only a couple of hiccups that I need to point out.
- The board seemed to have small data corruption over Serial port (see the reference on electronics programming).
- I only saw it happen in one occasion, but it’s worrying enough to warrant this warning.
- The board could not be programmed via USB alone with the bootloader flashed in. It always required the use of the
programmer board.
- This happened every single time, but I do believe this was an issue with the bootloader/support for FabSam and not an issue caused by the lack of consumption of power from the USB.
Minor corruption in serial communication
Some responses from the microcontroller to the computer seem to have been malformed.
I have not seen evidence of corruption from the PC to the board, but it’s interesting seeing this, and seeing how it gets corrupted twice in the exact same way, in such a short amount of time
Reviving an old power supply
This old power supply I found on the lab seemed like would probably work, of we could find the leads at the other end.
Specifically, an old barrel jack, is what I needed for my board. I found a set of 5 jacks, which was perfect.
The only dangerous thing was getting the polarity right, so it would match my board needs, and the assumptions made on my design.
A small bit of solder and a pair of heat-shrink wraps will do the trick.
Using a small heater, we can safely insulate the cabling to make sure they are not exposed to the environment.
The final test to validate that it works well and it outputs the right voltage (and polarity).
Future iterations on power management
One of the initial ideas for the board was to allow it to be powered over USB for simple operations (programming it, controlling 1 or 2 servos, etc…) while also supporting a 12V input for “production use”.
Benefits:
- It would work without having to carry around the heavy 12V supply
- It would be working with most of its features without any external dependencies
Cons:
- More complex design and wiring
- More complex use: It would require the use of jumpers, or jumper cables to ensure protection in the case of user error (suppose I accidentally plug in the USB port AND the 12V supply: How can I protect the computer from 5V incoming? Having Controller Devices receiving power is almost certainly not part of the USB standard.)
The complexity from this design was discarded for the initial iterations because, while neat, would require too much effort to compensate the risks.
Microcontroller choice
Having spent the entire fab academy using SAMD11C chips, I wanted to try using a more complex one, and this looked like the project where the extra pins would come in handy (5 for servos, 2 or 3 for the coin acceptor, depending on if I needed some advanced features, etc…)
In the end I went for the Atmel SAMD11D14AS, which is similar enough to the D11C but with extra pins.
This chip did not work as smoothly as the D11C, and the electronics programming page will cover a lot of the lessons learned.
Iterations in design
Iteration 1
Since it was the first time I was using this microcontroller, I wanted to use the first iteration as a prototype (to explore features) and also as a testing board that I could actually use for the final project, in case I ran out of time.
This is the reason that I created a small frankenboard that would expose all the pins of the chip, so they could be used and tested individually.
Iteration 2
The second board was a small variation on the first one, but with cleaned up layout and only exposing the pins actually needed.
The idea behind this design was to actually output the servo connections, so they can be plugged in directly.
Iteration 3
There was an issue while trying to program the board in iteration 2 as it was extremely flaky.
With the deadline fast approaching, I decided to find a middle ground to improve cable management and neatness: using the original board, but creating a small servo driver board that will do the breakout of pins and allow simple connections for servos.