Backyard Brains Logo

Neuroscience for Everyone!

+1 734 968-7570

items ()

The Roach Race-Cockroaches on Wheels to study Circadian Rhythms!

Welcome to the cockroach world!




My work for these five weeks was to develop a novel low-cost system to study the circadian rhythm of cockroaches. I’m working with my beautiful friends discoid cockroaches (B. discoidalis).



Circadian rhythms are physical, mental, and behavioral changes that follow a roughly 24-hour cycle, responding primarily to light and darkness in an organism’s environment. In the case of these nocturnal creatures the changes in locomotor activity (what I’m measuring) goes from sleeping during daylight, and activity during night. The sleep-wake cycle is generated by an internal clock that is synchronized to the light-dark cycle of the environment.  Because they are nocturnal, light may directly inhibit locomotor activity.

We asked what would happen to the activity patterns of discoid roaches if they kept a normal 12 hour light/dark cycle for ten days and then switched to 24 hours of darkness for another ten days, and then with constant light. In the absence of external cues to tell the cockroach what time of day it is, our hypothesis is that we will see free-running, and a new activity cycle will develop based solely on the internal biological clock. To track this, we measure the activity of the cockroach with running-wheels throughout the day in free-running conditions (no external cues), along with sensors to track light and temperature.  From this we hope to develop the cockroach wheel as a model for educating students about circadian rhythms, animal behavior, and neuroscience, and to provide a simple, low-cost, but flexible experimental system for research into the behavioral effects of various commonly consumed substances such as caffeine.

The rhythm in cockroaches is controlled by the sub-oesophageal ganglion. The photoreceptors on eyes detects light or darkness, transduce the signal, this signal goes through the optical nerve to the optic lobe (where is located the clock), this one receives the message and output the activity. I will control the external cue (light) that her brain used to output the activity that corresponds to the time.







Want to study with cockroaches?


When I came here 5 weeks ago I began with a microcontroller (BeagleBone Black), the green board with sensors, a wheel with some black,
and white stripes, a devilish code to run all of this,  and knowing nothing about anything of the electrical and computer science work that I was needed to do.

As soon as possible I put everything to work. My older set-up looks like the photo at the right-it was in Karina3a box that I carried to my house several times in order to record data. I need them this way because the BeagleBone wasn’t, at the time programmed to access Internet through an ethernet Karina4cable, so I needed it, at all times, connected to my computer and my laptop turned on. The most difficult objective to complete was to have the code with all the commands in the correct way so it can collect good data. There seemed to always be a problem with missing, commented, uncommented, or extra lines that made this code a stressful thing to work with.

I now have five 3D printed running-wheels with plenty space for the cockroach and a good object sensor at the back, the light sensor to tell when the lights go on and off, and temperature sensors that showed the environment was constant.  I attached these to the support of the wheel, all in a comfortable locker with soundproofing foam (to eliminate outside noise), and a device that control when the lights goes on and off. The board with these sensors is attached to the BeagleBone Black, and the BBB runs through Wi-Fi (no easy feat). Though not done yet, my code is getting better with the help of people like Stanislav our programmer, and Max and Nick-our resident super-engineers. Now the system is complete and beautiful:

Karina8Karina7Research in Progress

Outlet Timer                                              Wi-Fi adapter                                        Research in Progress


Karina9Karina10 Karina11

Sensors at the back                  Object sensor with B/W Stripes   Microcontroller with breadboard (red)














The Fantastic Five



Let there be (12 hour cycle) light!                      Cockroach Rave

Want to see cool cockroaches running on the wheel? Click here:

The fastest one? Click here:

Environment for cockroaches

I put my cockroaches in a controlled environment with no karina15external cues interfering, such as noise or light during night, that could let them know what time of day it is. We don’t want them to potentially associate other external cues to time because their rhythm will be based on other cues, and not on light cues which we control and provide.  In order to achieve this I put them in a locker with soundproofing foam, a stripe of LED lights (sun light), and the green board that contains the sensors attached to the 3D printed running-wheel for a sexy and clean set-up.



Understanding the collected data

Now that we have all the set-up, let’s move to the best part-Science! In my data I have a range of arbitrary values that will represent whether the sensor received lots of infrared light back or not. That usually goes from 2500 to 4000-A value of 2500 means that the sensor was in front of a white stripe, and if in front of black stripe the value can go up to 4000. Every time the cockroach moves, the stripes do too, and so I can see in my data the movements in a wave that goes from white (2500) to black (4000).karina16








How object sensor works














Set-up to collect data



First ever collection of complete 23.3 hours of data!

Cockroaches are nocturnal animals, that’s why light may directly inhibit locomotor activity in a them.  I’m looking for a pattern of activity-once I have that, I will begin with the dark/dark cycle, and compare this data to the normal cycle they exhibit.









You’re seeing two circadian rhythms of two different cockroaches in the same environment. As you see, It showed a rhythmicity, although does not follow the light cycle. This may have been because the cockroaches were living in a dark room. A couple of weeks are needed for them to adjust to the light cycle.This is the most astounding data I ever saw. This is the first time data is collected and plotted in an actogram. Hope you enjoyed like I do.

Why study circadian rhythms

My main goal for this project is to prove the system is viable to study the circadian rhythms of cockroaches, and I did it. Research in this area can lead to knowledge about how the daily cycle in humans works, and what are the consequences of disruptions to it. It is known that disruptions to the circadian rhythms are highly related to cancer, obesity, mood disorders, stress, and other health issues.

You made it! Thanks for taking the time to read how it is going with my research.


Behind this project isKarina22

The Alpha Dog, also called Karina M. Matos Fernández. I study Psychology and Mental Health in the University of Puerto Rico in Ponce, and I’m a proudly intern in Backyard Brains. For this project I’m using papers such as Control of the circadian rhythm of activity in the cockroach by John Brady, along with Recording and Analysis of Circadian Rhythms in Running-wheel Activity in Rodents by Verwey, Robinson, and Amir.

I’ve never known anything about what a microcontroller is or could do, and this month I programed six of the most finicky kind-BeagleBones. That’s why I’m called The Alpha Dog. Also it never crossed my mind that I would be so close to a cockroach… And yet, now I love them. How could one not love these amazing creatures?

If you are wondering how I beat my fear of cockroaches, let me tell you that I’m still working on that. In case no one was available to grab them, I used a special mechanism I invented consisting of a cup and a lid: these two helped me to grab them. However, I still feel a special love for them.

I’ll be glad to know who you are, and what are your questions and comments. I hope that now you’re interested in making research with cool model systems such as this one. Whoever is out there, I want to know more about you. Keep in touch to know more about the progress of the project.


To be continued…


Katelyn Rowley put some scientific

photos in my post. Thanks!



Become a Cricket Pick-Up-Artist with Nick!

So you’re trying to pick up Crickets?

In this day and age there are services for everything; online dating for farmers, pastors, and anyone who’s looking for that special someone. Just nothing out there to help you find that very special cricket love. Well don’t worry, you won’t need a special site or even special skills!  All you need is a couple calling songs and you can find the male or female of your dreams, if in those dreams you happen to be a brown cricket (Acheta domestica).


When I posted previously I was in stages of nailing (pinning?) down the right prep to get the best results possible. Suction electrodes were a possibility but proved to be too much of a time consuming, finicky prep. So when I went back to the silver wires, I tried new placements within the cricket and ended up finding a couple sweet spots that yielded some interesting results. Pictured above is the prep that has been giving me the best signal to noise ratio possible to see neuron spikes when frequencies are being played to the cricket. After several trials with this prep we found out that 3, 4, and 5 kHz frequencies would be the best ones to test at this point because this is the range male crickets produce their calling chirps in. So if you can chirp like that you can get a date with any cricket in the land. Quick Pro Tip: the females tend to roam during the day and in warmer weather so that’s when the optimal pickup tones should be tried.


This is a 3 kHz frequency trial. Each trial was performed on female crickets with recordings played on their left side (where the wires were placed). These tones were produced manually at the time, however it has become automated through Matlab since then. The color bar above the green, in this case orange, represents each tone being played for roughly 25 trials. The green spikes represent the neuron spiking in reaction to the tone being played. As you can see the 3 kHz produced a lot of neuron spikes. Looking at this makes it seem like 3 kHz would be a “sweet spot” for optimal spiking in accordance to their naturally attuned frequencies, however this response doesn’t always happen.


This is the 4 kHz trial, clearly also producing many spikes. Not as many as the 3 kHz trial but according to some literature this range 4-5 kHz is the main calling song brown crickets produce. So going forward, most of my tests will consist of frequencies within this range.


The 5 kHz trail producing a poor amount of definitive neuron spikes. Some of the spiking in response to tone playing was removed because it was confirmed to be muscle movement of the cricket and not specifically a neuron responding to sound.

3 kHz:


4 kHz:


5 kHz:


These Raster Plots represent the number of spikes produced by the neurons in the cricket’s ear after the onset of the tone (colored line). So each tick mark represents one action potential.  In most cases there is a delay after the tone before the first neuron fires in response to it. It will take more trials to determine the exact time of it, or to test if it coincides with some other studies.  The y-axis represents what number trial it was and the bottom is time in seconds, with 0 representing tone onset. In the histogram the number of spikes correlates with the time. So each bar represents the number of spikes that occurred during the same time period across trials. Each tone, whether it was 3, 4, or 5 kHz produced valuable data, and showed that each frequency could elicit a neuronal response in cricket’s ears. 3 and 4 however seemed produced a much better response it terms of neurons firing.

With all this information gathered I made a poster and presented it at Mid-SURE. While this shows a clear response to frequencies, I think this information more importantly represents an ability to obtain this kind of data with this simple, accessible, and easy to understand setup.  I will be trying to find the best signal to noise ratio such that I can objectively determine what is a neuron spike vs a muscle signal vs noise. As far as the cricket “cat calling” goes, I know which frequencies should produce a response and will be testing those more thoroughly moving forward, as well as a few frequencies that the crickets should be deaf to, and therefore should not elicit a response as a control.  I have automated tones playing and a randomization protocol which ensures a pure response to the frequency. So now my research will involve tweaking the silver wire placement and playing different series of tones to elicit a response, so essentially the same prep I have been doing this whole summer but much more concentrated now that I have a better understanding of the prime frequencies to play and where to put the recording electrodes, the silver wires. My end goal would be to reproduce this same type of data and conclusions as presented on my poster but with much more trials and many more frequencies. We have the ability, now, to test ultrasonic frequencies like 18 kHz and above, important because the crickets detect these frequencies to avoid being eaten by bats. So many more tiny surgeries are needed to ensure you guys the best possible call to get the male or female cricket of your dreams.

Are you conscious? Now with our consciousness detector, you can find out!

Hello again! This is the mind-reader reporting to you with updates on my project. I have had quite the scientific adventure since last sharing my research so sit down, grab your tea (or coffee or pop or kool-aide – I don’t judge) and prepare for a rollercoaster.


With no success from LED oddball tasks, I moved to replicate an auditory oddball task from a paper that describes P300 responses from minimally conscious and vegetative subjects. If subjects with severe brain damage are able to produce results from that task, shouldn’t a healthy brain produce them as well? With this thinking in mind, I created a task that produces an Arduino-driven tone from a buzzer that lasts 100 ms, with 900 ms between each tone.  The oddball tone is coded to appear 14% of the time. When this tone appears, the subject makes a tally until we reach 50 tallies, as the P300 signal is reliable after 30 to 40 oddball stimuli have been presented. The signal sent to the buzzer is essentially copied and sent to the EEG so that the tone activation can be seen in the Spike Recorder app, as shown below.







With this information in the app, the data can be averaged around tone onset. I set out to make this work – except it didn’t. Trial after trial returned a flat average. I was finding something that I thought looked like the P300 but the absence of anything substantial from the average suggested that what I was looking at was not consistent enough to be called science.

This lack of success caused me to scale back the project and start from the absolute basics.

One of the current BYB EEG experiments involves finding the alpha wave: a 10 Hz signal that appears from the occipital lobe when the eyes are closed (can be viewed at This experiment was used as a control to ensure that the EEG was working as it should. We attached three shields to the board to allow for three recording locations: occipital lobe, right temporal lobe, and a forehead control.


To ensure that activity was not dependent on the shield, we cycled the inputs from each recording location so that every location was recorded through each shield. The results confirmed that the alpha wave is most intense over the occipital lobe, less intense but still visible over another cortical location, and nonexistent over a non-cortical location (changes in intensity can be seen in RMS values). With confirmation that the shields are functioning as they should, I climbed to the next control: the flash visual evoked potential.

Flash visual evoked potentials (fVEP) represent electrical signals generated by the occipital region of the cortex when the subject is stimulated with flashes. The main components of the signal are those displayed to the right and are named for their latency, which is highly variable between subject and taskkylie6, and their polarity. kylie5The flash task created to elicit this waveform was powered by an Arduino and a surge protector that has been engineered to receive power inputs through a wire. The Arduino sends constant power to the bulb until the push of a button begins light flashes at a rate of 1/sec for 60 ms each. Each recording begins with an alpha task to ensure that the signal is legitimate. After the signal is verified, the subject sits motionless in my office for one minute and watches the flashing of the bulb. Because of the small amplitude of the fVEP response, the waveform is easily
lost in a raw EEG signal. It is only through averaging of trials that this evoked potential is visible, since the information common to the entire recording will be averaged out. Errors in the Spike Recorder software averaging caused us to call in Matlab for offline data
analysis. One second of data was collected surrounding flash onset and all of these epochs were averaged after eliminating outlier responses. The fVEP mean is then plotted against a Monte Carlo mean to show where and when the data is statistically significant – any data falling within the 95% confidence interval is deemed insignificant. If the data is significant and the waveform components match the literature in latency and amplitude, I considered the trial a success. Several successful trials indicated to me that the fVEP procedure produced what was necessary for the signal to appear and that the data analysis allowed us to see this particular event-related potential. Hoorah! It is possible. Equipped with new Matlab skills and some inspiration, I refocused my project to finding the P300.


My initial set-up for the oddball task was not scientifically sound, so some adjustments to better control and rkylie7ecord the stimuli were necessary. With a better designed experiment and several loyal subjects, data collection was in full swing. After collection, the data was run through an adapted Matlab script specific to the task. This script creates a plot of 1.4 seconds surrounding standard tone onset, 1.4 seconds surrounding oddball tone onset, a Monte Carlo simulation, and a plot of all three plotted together for comparison with outlier data excluded, same as before.

The code outputs the largest positive potential between 300 and 600 ms after tone onset, displaying the latency and change in amplitude from baseline for that point. The results are very exciting! We appear to have a P300 on our hands. Nearly half of the recordings taken thus far have had significant results. As I am only three days of data collection in, I’m happy with that! A lack of significance in the other trials could be from poor recording location, high impedance between the electrode and the skin, or simply poor attention allocation on the part of the subject. My goal now is to keep the positive results coming – more collection, more collection, more collection! Replication = science, right?