I’ve been working on the next in my EasyTTL series. Whereas my previous iteration had additional functions and output, this time I had a single goal: make a portable optogenetics TTL driver. This means making it as small as possible and, most importantly, battery powered.
While it is possible to run an Arduino off a battery source, they are pretty big and relatively power hungry. So, I wanted to find a smaller microcontroller to use for this purpose. It is, of course, possible to design a circuit from scratch to use a microcontroller, but that is a huge amount of effort. I would only want to go to those lengths if I had a good reason, like I needed to fit it into a miniscule space, or I was intending to make hundreds.
Fortunately, others have thought the same, and helpfully produced microcontroller breakout boards. Essentially this puts the chip on a board with easily accessible pins and all the control circuitry you need for easy programming via USB, with power regulation etc. I won’t go into all the available microcontroller boards, there are loads out there.
I picked the Adafruit Trinket (Figure 1), because it is small and can be programmed using Arduino IDE, which means I don’t even need to learn any new programming languages. You can think of it as a tiny Arduino, perfect for making a simple and portable optogenetics TTL driver.
The biggest drawback of the Trinket, or any smaller and more basic microcontroller, is that I lose functions; in particular there are fewer I/O pins to connect my switches and dials to. Whereas the Arduino Uno has 14 digital I/O pins, the Trinket only has 4. Now, I obviously need the TTL output and a switch to turn the flashing on/off. I also like to have an LED indicator of the TTL being switched on, which leaves a single pin to control the flashing frequency, on times etc.
With the restriction of a single available pin to control the flashing, I can put in a toggle switch to allow the user to choose between two stimulation paradigms. I will therefore just program my two “favourites”, ie. those that I see most often in the literature or that I am most likely to use myself in the lab:
- 10 ms flash on-time; 10 Hz frequency
- 10 ms flash on-time; 20 Hz frequency for 1 second, then off for 3 seconds
My loyal readers will know about my dislike of the 20 Hz and higher frequencies, but as you see them so often in the literature it felt remiss not to include. So anyway, I programmed the Trinket, connected it to switches etc, and hooked the output up to an oscilloscope (Figure 2).
The timing is very good, although it runs about 100 µs fast for a 10 ms pulse, giving it a timing accuracy of 99 %. While this isn’t as good as the Arduino, it is still great, and to be honest is far better than you would ever need for an optogenetics study, either in vivo or in vitro.
Next, I printed a housing unit for the Trinket and a 9 V battery, and I also included a slide switch to cut the power and prevent battery drain when not in use. I think it looks quite smart (Figure 3).
I can’t wait to turn up somewhere with this little box, and hook it up to drive a laser or LED in an optogenetics study.