I have mentioned Karl Diesseroth’s irradiance calculator in my blog. It’s a tool I’ve found useful in the past for predicting the depth of opsin activation for in vivo optogenetics experiments.
However, gleaning the pertinent information from Diesseroth’s irradiance calculator can itself be challenging. I almost find that it provides too much information. In fact, you can see from my blog post the only information I actually take from it is the depth at which the irradiance remains above the activation threshold for the opsin I’m using.
The standard irradiance threshold I use is 1 mW/mm^2 for two reasons:
It is the published EC50 for my opsin of choice ChR2H134R1
I have tested the response using electrophysiology and found good consistent activation of ChR2-expressing neurones using 1mW/mm^2
Using the calculator
For the purposes of my depth calculator, there are 4 values for you to input:
For light power, my recommendation is to use 10 mW, or as high as your system goes if it can’t reach 10 mW. For the fibre core and NA, I recommend using 200 µm and 0.22 NA, respectively (I use these from Thorlabs; check out my blog post for further info). Finally, the threshold irradiance you expect from the opsin you have used. For the fibre details and irradiance, I have put in recommended preset values, but you can of course change them to suit your specific experimental setup.
Once you have input your values, simply press “Calculate”, and the predicted stimulation depth of opsin activation will be calculated. A typical value to aim for is about 1.0-1.5 mm, as this gives plenty of leeway for experimental variability.
I hope people find my depth calculator to be useful and easy to use. I have also developed a tool to do the opposite calculation, ie. to predict the required light power needed based on your experimental needs.
1. Lin et al., Biophysical J 96, 1803-1814 (2009) Characterization of engineered channelrhodopsin variants with improved properties and kinetics.
A couple of years ago, I ran an optogenetics experiment with bilateral light stimulation in the hypothalamus. Or rather, that was how I planned it. However, when it came to tethering and stimulating the mice, the fibres were too close to each other. I ended up doing unilateral stimulations, and realised that I would need to do angled opto fibres for any future bilateral studies.
Luckily, a stereotaxic frame comes with a pivot to allow exactly this kind of thing. There’s usually a pin holding it vertically; take that out and you can tilt the top half as needed to your desired angle. There’s an “angle scale” to do this accurately, and then you can clamp the whole thing in place.
So now comes the sticky question: how do you work out a new set of coordinates based on an angled implant? Turns out, all you need is a bit of trigonometry (Mr Turner did tell me it would be useful later in life, I just never believed him).
I drew a diagram to calculate the new coordinates based on my chosen angle of 10⁰. I used sine and cosine to derive the unknown lengths:
Now, I can tell you, these calculations were a faff, so I will avoid them in the future if possible. And, I will also say that I am the only person in the lab who has attempted angled fibres. Everyone else just does unilateral, and I thing a large part of their reticence is caused by ignorance of how to calculate the angled opto fibres.
With that in mind, I have developed a handy tool to do these calculations for you. Just input your starting lateral and dorsal coordinates, and the angle to tilt your fibres. I recommend 10⁰. Then press “Calculate” and the script will output your new lateral and dorsal lengths.
I hope people find my tool useful, and encourage them to use angled opto fibres in their studies.
A contemporary approach to the refinement of animal research highlights the importance of technology and the 3 R’s:
“Employing new in vivo technologies that can benefit animal welfare and science including methods to minimise pain and distress as well as to deliver enhancements in animal care, housing, handling, training and use”1
This definition fits well with my experience of animals in research – the less you stress your animals while running experiments, the better your data will be, and technology is an important way to reduce your impact on the animal whilst also improving your metrics.
My history with technology
As an example, for my PhD I wanted to investigate control of the cardiovascular system in a transgenic mouse model. I won’t go in to details here, but suffice to say it had a weird hypermetabolic phenotype which we thought would also impact the sympathetic control of the cardiovascular system. But how best to go about measuring this?
Let’s say you went to your GP with a suspected blood pressure issue, what would the doctor do? Most likely sit you down and measure your blood pressure with a plethysmograph (the cuff that goes on your arm and inflates) and your heart rate by counting beats. This was actually the first method I tried in my mice – we had a mouse-sized plethysmograph that works on the tail of the animal; it also comes with tubes to hold the mice steady while performing the experiment.
You don’t need to be a scientific researcher to realise that confining a mouse in a restricted holder like this will stress them out, even after repeated sessions of acclimatisation. And what happens when you’re stressed? Increased heart rate and blood pressure, which by definition makes this technique less than optimal.
However, it is possible to get decent data from such a system, so long as you bear in the mind the limitations when planning studies and drawing conclusions. As it happens, my transgenic mice that I used in this study were much smaller than the wildtypes, and as such I was unable to get reliable readings.
But, we really wanted to record blood pressure in this mouse model, so next step was to attempt a more invasive method to get a direct reading of blood pressure. This is possible, although technically very challenging in mice, by inserting a thin plastic tube into a major blood vessel and getting a direct readout of the pressure from inside the artery.
Obviously, you can’t go inserting a catheter into the artery of an awake mouse, so I anaesthetised my transgenics and learned how to insert the blood pressure catheter into the mouse’s carotid artery. We did get lovely blood pressure readings from this study, with the predictable caveat that it was performed in anaesthetised animals, and there aren’t many things in this world more likely to impact your cardiovascular system than being anaesthetised!
As it happens, we used a certain (old-school, not used in humans) anaesthetic known to have minimal impacts on the cardiovascular system. However, we knew we wouldn’t be able to publish the results without getting some kind of readings in an awake animal. This is where technology comes into the story, in the form of implantable telemetry.
It goes without saying that telemetry, while a great technological solution, is also technically quite challenging as well as prohibitively expensive. As such, and especially given that I was naïve to these methods, I opted for the easier biopotential transmitter to record ECG. Once I’d figured the experiments out and was able to get good heart rate recordings in awake freely moving mice, they formed the pinnacle of my PhD, and enabled us to publish the results.
In an ideal world, we would have used blood pressure telemetry (heart rate alone can give ambiguous results), but I think we made the correct decision at the time. One of my colleagues recently used the blood pressure telemeters, and had a terrible time of it – they’re just that much more difficult, especially the surgery.
Technology is important
Anyway, my takeaway message today relates the importance of technology and the 3 R’s for minimising the stress and harm done to animals in your experiments while simultaneously maximising the quality and impact of data you produce. I recently submitted a grant application to the NC3R’s with exactly this stated goal – to use my fibre-free optogenetics technology in vivo, to show that it has a marked benefit to animals in optogenetics studies, leading to a refinement, as outlined in the 3R’s.
1. Clark Br J Nutri 120(S1), S1-S7 (2018) The 3Rs in research: a contemporary approach to replacement, reduction and refinement
I have previously talked about developing a touch-free timer for use in surgery. The goal was to better enable a single researcher to maintain sterility during animal surgeries. I really think this is a genuine unmet need in the research world, and widespread adoption of touch-free surgery kit would be extremely beneficial, both to the researchers and to the animals.
Anyway, with the plan to expand my touch-free surgery range, I figured the next piece of kit should be a heat mat for keeping rodents warm in surgery. And again, I wanted something that can be controlled by touch-free sensors. Helpfully, Pi Hut sell a small, flexible heating pad:
Looking at the specs, it uses ~1 A of power, which is far more than we can safely run from an Arduino digital pin. In order to do this, we make use of a component called a MOSFET, which is a special kind of transistor used to amplify circuits. A MOSFET lets you use a digital signal (eg. an Arduino output pin) to fully switch a separate circuit (eg. a fully powered heat mat).
Therefore, using a MOSFET, I can control the power going to the heat mat by the digital output of the Arduino. I’ve mentioned pulse width modulation (PWM) before, and it is perfectly suited to this application. PWM will let me digitally control the amount of power going through the heat mat. And, best of all, because it’s digitally controlled, I can shift the PWM up/down with IR proximity sensors.
But, how to display the power going through the heat mat? For this, I again turned to Pi Hut, who sell a 10-segment LED bar:
Each LED in the bar is individually controlled, which means that I can set the Arduino to display an indication of the power going through the heat mat, on a scale of 1-10. Bringing it all together in a 3D printed housing, I have power up and power down proximity sensors, a power indicator bar, and a flexible heat mat that warms quickly to the extent determined by the user:
I have used this heat mat in surgery myself, and it worked really well. It heated up super quick and I could change the power of the heat mat to the temperature needed by the mouse. This piece of kit is indispensible for keeping rodents warm in surgery.
The one thing that I think it missing is an actual reading of the mouse’s temperature – I kept having to feel the surgery bed to check the temperature, which kind of defeats the purpose of being touch-free.
So, my next plan for this piece of kit is to add in a temperature sensor (whether a standalone one or one that runs through the Arduino, I have yet to figure out). Stay tuned for updates.
This is a quick update to my previous blog post, where I explained making a touch-free surgery timer. Unfortunately, I found that it just wasn’t working well – as I explained previously, the low voltage used by that timer (1.5 V from a single AA battery) was not enough to make multiple IR sensors respond to the proximity of a finger.
After some brain-storming for how to fix this issue with sensing, I came to the conclusion that I really needed to start from scratch with a new (higher voltage) timer. I therefore scoured the internet for a timer with the following features:
Runs at 3-5 volts (ie. two or three 1.5 V batteries), but not from button batteries (they don’t have much capacity, so would drain too quickly)
Stopwatch and countdown timer functions
Controlled by limited number of pushbuttons (ideally Start/Stop and Reset for stopwatch, then “add minute” button to set up timer)
Has big light-up numbers for easy checking of timing
Finally, I found a timer that hit all my requirements, and only cost around £20 on Amazon (turns out the kind of timer I wanted with simple controls and big light-up numbers is targeted to children and the elderly):
So, I cracked the timer open, soldered in IR proximity sensors to the Start/Stop, Reset and Minute buttons, and found they worked great – I could control the timer by moving my finger to within 10 mm or so. Turns out there was some dead space inside the case, which meant that I could drill holes in the side and mount the sensors on the inside. I also added in a cutoff toggle switch to cut the power to the IR LED’s to prevent battery drain.
All in all, I’m really pleased with the new timer: I left it in the surgery room, and it’s going down brilliantly with the other lab members who’ve tried it.
Last blog post I had a revelation about the best numerical aperture to use for in vivo implanted optical fibres. Today, as part of my indepth study planning, I’ll be investigating the best opto flash time. My default has always been 10 ms, because a) it seems to be what most others use and b) it’s always worked well for me.
However, I like to be sure, and it never hurts to optimise your methodology. But where to start? I’ve mentioned in the past about the EC50 of ChR2 being 1 mW/mm2. However, this is actually misleading, as it doesn’t take into account the duration of illumination.
Power, energy and time
The important point here is that mW is a unit of Power (Watts), which is energy (Joules) over time (seconds). And the thing that actually determines activation of the opsin is the energy that it is exposed to. What this means is that, in principle, you could have wildly differing power output activating ChR2 to the same extent, so long as you adjusted the length of time of illumination accordingly.
If we think of a typical in vivo light flash of 10 mW for 10 ms from a 200 µm fibre, we can calculate the energy emitted in this flash with the equation Power (W) = Energy (J)/Time (s):
Energy (J) = 0.01 W x 0.01 s
= 0.0001 J
So we can say that 0.0001 J (or 100 µJ) of 470 nm light is enough energy from a 200 µm diameter fibre to robustly activate ChR2 in the brain in an experimental setting.
Low opto power
Now let’s say we could only produce 100 µW from our fibre (100-fold less than in the previous example). We could theoretically activate ChR2 by adjusting the illumination time accordingly:
Time (s) = 0.0001 J / 0.0001 W
= 1 s
What this means is that if we had a pitifully weak light source, we could still activate ChR2. Although, I’m not sure how useful 1 Hz neuronal stimulation would be biologically. However, there is a way to make this dim level of illumination biologically relevant, as Anpilov et al. did in their recent wireless opto study1. They did this by using a stabilised step-function opsin (SSFO), which acts more like a toggle switch – a single activation turns it on for 30 mins or so.
Fast opto flashing
We can also look in the other direction, power wise. Let’s say you were interested in making neurones fire at 100 Hz. To maintain a 10 % duty cycle (to allow the neurones to recover electrically and to limit tissue warming), we might want a 1 ms light flash, and we could calculate the required optical power like this:
Power (W) = 0.0001 J / 0.001 s
= 0.1 W
So, to drive a fast-frequency neurone like this with an equivalently robust activation of ChR2, we would need to be able to produce 100 mW out the end of a 200 µm fibre, which would be possible with a laser system. A quick note: 100 mW is actually a lot of light power to pump into a mouse’s brain. So, I would not advise aiming that high. I would worry about heating or damaging the tissue, so better to limit yourself to 15 mW or so, and validate your experiment accordingly.
Measured opto flash times
Anyway, back to my planned experiment. The question was: do I need my full 10 ms flash time to produce the firing I want? A recent paper by Herman et al. investigated the silencing of ChR2-expressing neurones at higher light exposures2. It includes a nice overall picture of light pulse duration-dependent spike probabilities in a variety of neurones (Figure 1).
What they find, flashing various neurone types at 20 Hz, is that with light pulses of 5 or 10 ms they have increasing spike probabilities up to 95 – 100 % depending on the neurone type. Then at on-times of 25 ms or longer, the spiking fidelity drops in all neurone types except for fast-spiking neurones in the cortex. Based on this work, I would suggest 5-10 ms appear to be optimal across various neurone types. At any pulse length above or below that, the spiking falls away.
Right, while 5-10 ms looks like a good time duration, that study was performed at a single light intensity, so only provides a partial answer. However, I found an early paper that investigated the threshold light power needed to stimulate an action potential at various distances from the end of the fibre, across a range of pulse widths (Figure 2)3.
A couple of things are clear from Figure 2:
Longer pulse widths drop the power threshold needed to trigger an action potential.
The threshold power needed to trigger an action potential increases with distance from the fibre tip.
It’s difficult to tell from the tiny scale on this graph, but it looks like 5 ms might just be enough to trigger an action potential at 1 mm from fibre tip at the ~9 mW power we get from our system. However, this is dependent on other factors, such as the NA of the implanted fibre.
The best opto flash time
My verdict form this investigation is that 5 ms would likely be fine to trigger a response. However, increasing the flash duration to 10 ms would increase your likelihood of triggering action potentials without any noticeable drawbacks. So after all that, we come back to 10 ms as the best opto flash time (in my opinion).
1. Anplilov et al. Neuron 107(4), 644-655 (2020) Wireless Optogenetic Stimulation of Oxytocin Neurons in a Semi-natural Setup Dynamically Elevates Both Pro-social and Agonistic Behaviors
2. Herman et al. eLife 3, e01481 (2014) Cell type-specific and time-dependent light exposure contribute to silencing in neurons expressing Channelrhodopsin-2
3. Foutz et al. J Neurophysiol 107, 3235-3245 (2012) Theoretical principles underlying optical stimulation of a channelrhodopsin-2positive pyramidal neuron
Planning another optogenetics study, and I needed to cut the optic fibre cannulae ready for implantation. One of the other postdocs in the lab had been super organised and bought in a bunch of implants from Thorlabs at a variety of numerical apertures (thanks Amy). But, which is the best numerical aperture (NA) for my experiment?
I won’t go into details (because I’m not a physicist), but Wikipedia defines the NA of an optical system as “a dimensionless number that characterises the range of angles over which the system can accept or emit light”.
Essentially, as far as we are concerned for fibre optics, the NA is relevant for two things:
The bigger the NA, the more light from the source will travel down the optic fibre – for a laser system, this doesn’t matter much because the coherent light can easily be focused down it, but for an LED, this can make a big difference for how much light is captured by the fibre (rather than scattering away)
It determines how much the light spreads after exiting the fibre (for in vivo opto’s, this will be in the mouse’s brain) – the higher the NA, the greater the cone of light dispersion
So, back to cutting fibres, and I had to decide which ones to use – I normally use the 0.22 NA fibres out of habit, but I have read multiple recommendations to use as high an NA fibre as possible when using an LED system (which is what we have); the idea being to get as much light power as possible into the mouse’s brain, which is important considering LED systems can struggle to be bright enough for in vivo opto’s. Both Prizmatix and Doric suggest using 0.66 NA fibres for LED-connected systems, which is actually higher than the ones we have available from Thorlabs.
To test the light output, I hooked up fibres of different NA’s to our LED optogenetics system, and recorded the light power out the end of the fibre using a light meter, both under constant illumination and during 10 Hz flashing with 10 ms on times (Table 1).
True to form, the higher the NA of a fibre, the more light that is passed down it. Great, so at this point I’d pretty much settled on the 0.50 NA fibre, because it emitted approx. 50 % more power than the 0.22 NA fibre. However, for the sake of completeness, I decided to input the values into Karl Deisseroth’s irradiance predictor, to check how deep I would get good ChR2 activation. This is a useful step when planning placement of your optic fibres.
I plotted the values for all three NA fibres (Figure 1), and I’ve included the threshold level of 1 mW/mm2 that I’ve talked about previously (this is the measured EC50 of ChR2 H134R, which I use as a threshold irradiance to assume good activation).
Now I’ll be honest, I was surprised by this outcome – despite having lower light output from the lower NA fibres, the irradiance was higher as soon as you go deeper than about 0.2 mm into the tissue. I can only assume this is because the lower NA results in less light spread coming out of the fibre – the 0.50 NA fibre remains above the critical 1 mW/mm2 down to about 1.0 mm, whereas the 0.22 NA fibre goes to about 1.4 mm.
The answer is simple – I’m going to use the 0.22 NA fibres, because they have the dual benefit of activating ChR2 to a greater depth, and also having lower brightness at the end of the fibre, which means less heating of the tissue and phototoxicity.
One of my projects is investigating a population of neurones that controls mouse locomotor activity and food intake. In the past I have used either implantable telemetry or IR beam break cages to quantify the mice’s movement. But the telemeters, even when they’re functioning well, don’t give particularly good quantification of mouse locomotor activity, which leaves the beam break cages.
For anyone that doesn’t know, these cages are set up to have a couple of IR beams that cross the cage. Whenever the beam is broken (ie. the mouse gets in the way), this is registered by the computer. It’s quite an effective (although crude) method to quantify mouse activity. And it does so completely non-invasively. However, our current IR beam break cages have a number of drawbacks that make them unattractive:
They only work with some of the older open cages, and don’t work at all if the mice have any bedding in the cage (it blocks the beams)
The beam break cages we have available in the facility, which actually belong to one of the other lecturers (although she is happy for us to use them), are a decade or two old and were built by a previous postdoc – as such they have suffered some degradation over the years and only have partial functionality left
Anyone who reads my blog will already know what I’m about to say – with these issues I’ve raised, I decided to try and build my own set of beam break cages.
Setting up beam breaks
Right, so first step was to find some IR LED’s and sensors that I could pair across 20-30 cm of a mouse’s cage. I’ve used things like this in the past, so I know you can detect an IR signal using an LED in the ~900 nm range and a phototransistor (Figure 1A).
Luckily, I had some sat around, so I hooked them up to an Arduino, but could only detect the IR signal up to around 5 cm distance. This is obviously not enough, so after some detective work, I found some “IR Beam Break Sensors” from PiHut (Figure 1B). If those didn’t work, it would require some more complex electrical engineering to make it work. Apparently you need to use modulated signals to be sensitive enough to work over multiple metres.
Fortunately, the IR sensors from PiHut worked a treat, up to about 40 cm, which is more than enough for my purposes. The next issue was how to fix the sensors in a way that they would remain aligned in a pairing across the cage.
Aligning the sensors
For this I turned to my trusted 3D printer. After borrowing an IVC from the animal facility, I figured I could make hanging holders that would hook onto the side ridges (Figure 2).
These worked great, with the only issue that the mice tended to move their bedding around and block the direct beams. A very simple solution to this problem was to use strong neodymium magnets to “pin” the tube/bedding at one end of the cage, out of the way of the sensor beams.
Right, so now I had 2 pairs of sensors successfully attached to each mouse cage, next I needed to actually track the data in some way.
Tracking data using Arduino
It turns out that tallying IR beam crosses is easy peasy using an Arduino. The only annoyance being having to duplicate the code 24 times (ie. 2 sensors each for 12 cages). But, I still need to get the data out of the Arduino. I figured I could either hook up an SD card reader and write the data to a removable card, or hook up to a PC and download the data directly.
As I was already connecting the Arduino to my laptop, I tried that first. A little Google sleuthing found me an open source (ie. free) “terminal” program, that will happily log data that comes in over a “COM” port, such as is used by the Arduino. It was actually really easy to set up, and will log the IR beam break data in a CSV (comma separated values) format, that can be directly opened by Excel.
For ease of later data analysis, I made the program log the data in 10 second intervals. However, it will be easy to change that depending on the experimental paradigm eg. 1 or even 10 minute intervals for longer term studies over days or weeks.
Just to prove how well the system works, you can see a massive increase in activity following injection of caffeine (Figure 3A). You also get fantastic circadian activity if you record for longer time periods (Figure 3B).
Where to get it from
As always, I am making this system available on my shop, far cheaper than any commercially available system. Obviously I’ll include a copy of the data logging software with instructions of how to use it. Anyone who wants to measure mouse locomotor activity easily and cheaply, check it out.
Edit 5/5/22: I have now uploaded details of how to make this kit to Hackaday, so head over there if you want to try and build it yourself.
My interest in wireless optogenetics has come up a couple of times. In fact, I’ll start with a quick correction: I prefer to call it fibre-free optogenetics, after multiple people mistook my wireless system I was designing as meaning controlled via Bluetooth or WiFi. Which it ain’t. And, for me at least, the whole point of going “wireless” is to do away with the optic fibres, which really embody all the issues and difficulties with in vivo optogenetics:
Impacts to the animal – the need to have the animals in an open cage, with an open lid and a sterile environment to prevent damage to the fibres. Also, they tend to be stiff, having severe behavioural impacts.
Expensive and fragile – not much more to say, other than we have spent thousands of pounds maintaining the optic fibres for our optogenetics system. This may be more than is typical, but I think that’s because the Plexon fibres we use are very fine and lightweight – I have used more durable ones that were even worse for the mouse behaviour because of the added stiffness.
The most important reason to do away with the optic fibres, as far as I’m concerned, is the impact to the animal. Quite apart from minding the 3R’s with regards to animal welfare, tethering will inevitably cause stress, which is detrimental to the data you can acquire (Figure 1). In fact, it is to the NC3R’s that I am applying for funding to take my fibre-free opto system to the next level.
There is of course the added bonus with wireless optogenetics that you can do optogenetic stimulation in otherwise impossible setups. For example, I am very keen to use my fibre-free opto’s in our calorimetry system to measure energy expenditure in response to opto stim. This is done in an air-tight sealed container, which to my knowledge this has never been done with optogenetic stimulation in the brain.
After a fair bit of research, I have found 4 commercially available wireless in vivo optogenetics systems (Figure 2).
Helios by Plexon and Teleopto by Amuza are both very similar, except that the Helios headstage attaches to “normal” implants, whereas Teleopto make their own custom implants. Both require you to point an IR remote at the headstage constantly (ie. the flashing stops if the signal stops). Fi-Wi from Doric connects over radio signal to drive opto flashing; similar to Teleopto they use custom implants. Neurolux is a very different system to the other three, and uses electromagnetic induction to remotely power the implants. Hence the Neurolux implants are tiny and custom (the LED is actually on the end of the fibre that gets implanted).
I have collated a summary table of the various systems, including a number of parameters (Table 1). Included is the cost to buy a complete setup to stimulate 1 mouse at a time, which usually comes with a few implants. However, I was unable to find out the irradiance available from the Plexon Helios system, despite asking the sales people for those details.
Overall, the Doric system seems the best of the bunch; despite being the heaviest it is very compact and produces by far the highest irradiance. In fact, it provides higher irradiance than the system I’ve been developing, which comes out around 150 mW/mm2. Stay tuned, and I’ll be talking more about my system in the coming months.
1. Won et al., Nat Biomed Eng (2021) Wireless and battery-free technologies for nanoengineering.
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.