Home Current sensing software Julian Rogers Home

The Adafruit Trinket is small, cheap and programs like an Arduino. If you only need 5 ports it might well be the answer to your control problem! Of the 5 pins, all five can be used for digital input/output, 3 can be used for analog read 2 (or 3) can be used for analog write, 2 for I2C, 3 for SPI (but, of course, not all at once).

I have also used the Trinket in an automatic security light and in the custom TR7 fuel gauge.

The only problem with the Trinket is there is no serial comms though the usb lead which makes development a little harder. (But this can be got over - see the Adafruit site.)

The circuit is similar to my other motor control projects. I use 50% pwm from the trinket to produce an over-voltage using a MIC4422 amplifier and a voltage doubler. I use a BD681 power transistor I had lying around and an 18 volt zener diode to keep the output at about 18 volts. The regulation is poor but it seems to work ok which is the main thing (as I said after more years than I care to remember, all I’ve got is Ohm’s law and instinct!) An LM317 regulator would have been better.

Another MIC4422 drives the output mosfet (VNP20N07). Requirements for a heatsink are minimal as the mosfet is either on or off and should dissipate very little. Also it only operates for a few seconds at a time. However, I always fit a small heat sink to be on the safe side.

As I was developing this circuit from scratch, I designed separate PCBs for each section of the circuit (the input from the relays, the power filtering, the current sensing and the Trinket, mosfets and drivers etc. This made the project much less compact than it could have been. (I then designed a “universal” motor control PCB to take a Trinket and all the other bits. I used this in the windscreen wiper project but had to use an Arduino Uno instead of a Trinket because the Trinket didn’t have enough pins so, unfortunately, my PCB was again bigger than it needed to be.)

How the trinket pins are used is shown left.

Next is the software:

Windows control circuit using the Adafruit Trinket