It’s Hard, We Know

Simplifying optogenetics equipment

I’ve mentioned once or twice the LED-based optogenetics system I’ve been working on recently, so I thought today I would put my faithful readers out of their misery and explain what I’ve been up to.

The driving force behind it was to simplify optogenetics experiments for the user, particularly with the hardware/user interface. I was actually reminded of this again yesterday, when it took me a while to sort out the stimulation protocol on the Radiant software I use for my optogenetics experiments.

So what I wanted was an easily programmable computer hardware that I could connect various LED’s and switches to, and there was really only one answer for me: an Arduino.

The Arduino Uno

For those that don’t know, Arduino is an open-source hardware/software company that produce electronics boards for the easy programming and use of microcontrollers. Their bog-standard model is the Uno (Figure 1); it has a USB input for easy programming by a computer and pin headers so you can easily connect to the microcontroller, for 14 digital in/out pins and 6 analog in pins.

I’ll save an indepth investigation into microcontrollers for another day. For now, suffice it to say that you can connect a huge array of sensors (eg. light detectors, or even switches) and outputs (eg. LED’s), and the Arduino will control them in whichever way you programmed it to.

The Arduino Uno

Controlling optogenetics

Anyway, my goal was to generate a TTL output to drive flashing of the LED, effectively controlling optogenetics with Arduino. Essentially, I want a physical switch that I can use to turn the flashing on and off, and the Arduino will output a signal for the stimulation parameters that I program it to do.

So, my electronics layout will look something like this (Figure 2). I have a toggle switch connecting pin 0 to ground (it has an internal pull-up resistor that sets the pin high, then latching the switch changes the signal to low), a pilot LED connected to pin 1, and an output TTL from pin 2.

Simple circuit for Arduino to flash and LED.

Coding the Arduino Uno

Next, we need to write the code, otherwise the Arduino will just sit there and do nothing. Fortunately, Arduino programming software is really easy to use, and they have endless tutorials and sample code online; if you want to do something but don’t know how, just type it into Google and someone will almost certainly have done it before.

To write our code, we have three sections:

  1. Naming any values
  2. Setup, which is where you instruct the Arduino for its beginning attributes
  3. Loop, which is the main program, and the Arduino will just cycle through your code endlessly in a loop, doing exactly whatever you tell it to do

Some notes on syntax:

  • Int          allows you to specify anything by an integer
  • ;              denotes the end of each “phrase”
  • {  }          denote each section or subsection
  • //            blanks out anything after it on that line, which is useful for putting in comments that won’t affect the program

Without further ado, here’s the simple program I wrote to run the TTL:

Arduino code for controlling optogenetics

I’ve put info into the comments about what the bits of code mean, hopefully it all makes sense. I found the Arduino to be quite easy to code (which I’m pretty sure is the point of them), so I would absolutely recommend any readers to pick one up. Anyone planning in vivo or in vitro optogenetics studies should consider controlling optogenetics with Arduino.

Even if you have no specific projects in mind, I think it’s great for everyone to have at least a basic understanding of electronic circuits and coding. And you might just find that you can solve some problems much easier than you thought.

A device for controlling optogenetics

I will add here an update about a device I have made to easily control optogenetics. I added a couple of dials to allow the user to easily switch pulse on-time and frequency, and housed it with a BNC output for the TTL. I have called it the EasyTTL Uno, and it is available to purchase in my shop. Alternatively, I have made the design specs and code freely available on Hackaday.

The EasyTTL Uno provides a single channel TTL output for controlling an optogenetics laser or LED. Stimulation parameters (pulse on-time and pulse frequency) are controlled by dials, and the flashing is turned on/off with a toggle switch. It’s super-easy to use, and fully customisable if you want to set your own flashing parameters. Please do check it out.

Of Mice and the Internet of Things

Ever since the long lost time of my PhD (about a decade ago), I have been excited by telemetry. More specifically, the use of telemetry and wireless technology to obtain high quality physiological data from mice.

During my PhD, I used telemetry to record ECG in transgenic mice, using DSI’s transmitters ( ECG was actually my second choice for investigating cardiovascular control in our knockout strain, but the blood pressure transmitters were too challenging for me to be confident in spending that much of our limited grant funding on.

The reason we wanted blood pressure recordings is that it is a much more reliable readout for the stimulation of the cardiovascular system, as there are many reflex control on heart rate that make it tricky to understand exactly what is going on (for example, if you stimulate cardiac output, you might well increase heart rate along with blood pressure, but then your baroreflex kicks in and the heart rate drops). As it turns out, I was able to delve into heart rate variability analyses using the ECG transmitters, which formed a large part of my thesis, so all turned out fine.

Anyway, I have more recently been using DSI telemetry to investigate body temperature and locomotor activity in mice, but have found myself getting annoyed. Between the surgery and singly housing animals, crappy battery life and expensive refurbs, short range recording and signal dropouts, it’s been getting on my nerves. And it’s 2021, why are we still using transmitters and recording technology that was developed 20 years ago?

After some time niggling away at the back of my mind that there must be a better way, I had a conversation with my dad about something he’s been working on (he’s technically retired, but is working with an old friend from the oil drilling business) about uses of the Internet of Things. This is one of those terms I’d heard, but thought it was a bit of a gimmick, like amphibious cars, or smartphones.

In fact, it turns out technology has reached the point where everything can be connected. For example, from the industrial sector that he was talking about, they can monitor the temperature of a certain piece of machinery, the pressure inside the system, performance indicators, pollution levels etc. Really, anything that might possibly want monitoring can have a sensor placed inside, which will be quiescent until certain parameters are met, and then it pings out a signal. This means that the battery drain is negligible, and the sensors can remain in place for years. Hearing this, I was excited to check out the state of the technology for my experiments; as researchers we are prone to just use the same as we always have. Here’s what I envisaged:

  • A transmitter that is small enough to implant through a (fat) needle, negating the need for pesky surgery
  • The signal is long-range enough, and includes identifying information, that you can have a single receiver for a number of group-housed mice
  • Implants are single-use – cheap(er) than DSI and disposable, so no faffing with refurbs and sterilisation

It’s possible that my desired were too restrictive, particularly with regards to the maximum size, because after much internet scouring, the best I was able to find was implantable ID chips like this from Unified Information Devices (UID –

These are injectable RFID chips that are primarily used for mouse identification. Apparently, such things are fairly common in industry, where you would subcutaneously implant every mouse with an RFID chip, allowing you to essentially scan a mouse like a barcode and it brings up all the relevant information about that animal.

The UID implants take the identification a step further, also providing a temperature readout along with the animal ID. Unfortunately, this normally requires you to “beep” the mouse with your reader at very close (likely skin contact) range. However, UID also produce a “mouse matrix”, that can read the info (including body temp and track movements) from outside the cage. They are quite pricey though.

The reason this is needed is that the RFID chips don’t have a battery, instead the tiny microchip is temporarily powered by the electromagnetic waves from the reader itself (same as the chips in most modern cash/credit cards).

So, I’ve been thinking, couldn’t you put a tiny battery inside, and low-powered, infrequent data transmission? You would only have to transmit every 5 or 10 minutes, so surely even a tiny battery could manage that? There is a product called Anipill, which takes a similar approach ( Their 1.7g implant sends out data at various timeframes from 1 min to 1 hour, and you can record data from a number of animals (up to 8) simultaneously from a single receiver, which improves the animal welfare by allowing group housing. This seems to be exactly what I had been thinking of, but with a capsule size of around 18 x 9 mm, it is far bigger than I had wanted.

Sadly then, if this company can’t make transmitters anywhere near small enough for injecting, then it’s probably not possible, at least with current technology. But, this is an area that is only improving from the advance of technology, so I will not lose my interest so easily.

Going Fibre-Free

Optogenetics is a fantastic technique, enabling the control of mouse behaviour with a high degree of temporal and neuron-specific precision. However, due to the high levels of light power needed to activate channelrhodopsin and its variants, a typical system will use a high intensity laser or LED connected via fibre-optics.

In my experience of doing opto’s, the fibres have proved to be the biggest technical issue, due to the high level of stress they incur in the mice. This comes as a result of a number of factors, including the requirement for housing the mice in an open cage, with a tether on the head that places some amount of torque on them at all times, and requires them to have their head upright. Also, because of the fragility of the optic fibres, the mice will often be housed alone and in a sterile environment. All this amounts to both unnecessary suffering for the animals, which as researchers we a morally bound to reduce whenever possible, but also to stress that will inevitably impact on any behavioural measure you are investigating.

This brings me to a paper that was published recently by Anpilov et al. in Neuron1, where they developed a wireless optogenetic stimulator to overcome these issues with fibre-connected opto’s and investigate social behaviours in a “semi-natural” setup.

From a technological standpoint, I am very interested in the device they developed, which is my primary interest in this paper. Their device is almost ludicrously simple – it’s just an LED connected to 2 button batteries via a magnetic switch, which results in a total weight of about 1g (Figure 1A). They connect this to the implanted optic fibre and cement the whole lot onto the mouse’s head. Then the LED can be switched on externally by proximity of a magnet (Figure 1B). This means that the mice can be kept in a complex group-housed environment and the opto’s switched on at will remotely (Figure 1C).

In fact, the researchers placed the magnet above the feeder, so they don’t ever need to disturb the animals. This enabled Anpilov et al. to influence aggression, grooming and other social behaviours in response to oxytocin activation, which would otherwise be extremely challenging to investigate using classical fibre-connected opto’s.

Figure 1. A Wireless Device for Prolonged Optogenetic Manipulation in a Semi-natural

(A) Schematic illustration of the wireless device. Two batteries are connected in series to an LED through a magnetic-field dependent reed-switch. The LED is attached on top of an optic cannula positioned above the dorsal part of the PVN.
(B) A device mounted on a freely behaving mouse activated by a magnet.
(C) Schematic illustration of the semi-ethological arena and software-controlled electromagnet installed on the feeder. The arena consists of an open 70 x 50 cm box containing a nest, feeders, water, elevated areas, and barriers.
(D) Light power emitted at the tip of the optic fiber as a function of the number of 2 s light pulses. Battery capacity is sufficient for over 215 pulses.
(E) Section through a 3D map of blue light intensity along the axis of an illuminating fiber in graymatter. The slice was imaged from below as the fiber was lowered through. The section is superimposed with a contour map of iso-intensity lines corresponding to light intensity levels. Light intensity >= 8microwatt/mm2 is sufficient for effective SSFO photoactivation. Taken from Anpilov et al. 2020 Neuron.

However, I do have some concerns to voice about the device they used, related to the actual light output they can achieve. Essentially, you can’t expect high light power through an optic fibre from a battery-connected LED – the light scatter doesn’t allow it. The upshot being that Anpilov only got 3.2mW/mm2, which is much dimmer than a typical opto system which will deliver 100-300mW/mm2 (our current system delivers around 175mW/mm2). Furthermore, their system has a maximum on-time of around 400s, which is why they cleverly used the SSFO to provide long-term activation after a very short stimulation pulse.

So, while the system developed in this paper clearly works well for their application of oxytocin-mediated social behaviours, I can imagine the further applications being relatively limited due to the following reasons:

  • Need to use SSFO or equivalent long-term responsive rhodopsin loses the high temporal precision you need for many optogenetic applications
  • Very low light output will likely mean further applications will be limited to those with very strong/sensitive behavioural responses, and probably with very dense neuron populations
  • The LED is only ON in close proximity to a magnet, which limits the design of environments that allow for activation without disturbing the animals.

Overall, I was impressed by the paper and am very interested in their approach to negate the drawbacks of fibre-connected optogenetics. But, I think their device has its own drawbacks, which if overcome would produce some very powerful tools with wide-ranging applications for in vivo optogenetics.

1 Anpilov et al. 2020 Neuron Wireless Optogenetic stimulation of Oxytocin neurons in a semi-natural setup dynamically elevates both pro-social and agonistic behaviours.