Backyard Brains Logo

Neuroscience for Everyone!

+1 (855) GET-SPIKES (855-438-7745)

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!



What does the Fish say? Electric fish spikes with Bailey

Hello my name is Bailey! I am a junior majoring in electrical engineering at Michigan State University and am doing an internship at Backyard Brains this summer. Sorry I missed the first blog post, I was travelling in Japan with my sister!


Left-my sister, Right-me

I know it doesn’t look like it from the picture, but I was doing some important background research for my project.


I mean…circuits were involved

Ok, so it was just for fun.

After getting over my jetlag it was time to get back to work. My project this summer involved mormyrid fishes. What’s so special about these fish? Mormyrid fish are awesome because they both emit and detect electric signals. Unlike an electric eel, however, their electrical discharges are too weak to harm other fish. Instead, they use electric signals to navigate their environment, which is naturally very cloudy, and communicate with each other. A lot can be learned about these fishes’ behavior and even evolutionary history just by studying their electric organ discharges (EODs).  Unfortunately the equipment used to record their EODs is quite costly, often prohibitively so-especially for those who live in the same area as the fish. This is where we come in. My goal this summer was to build an inexpensive, easy to use, and open source device that can record EODs from weakly electric fish.

Since the EODs occur at very high frequencies, a simpler microcontroller like an Arduino is not sufficiently powerful to record their EODs in real time. Enter the BeagleBone Black.



The BeagleBone Black has a 1GHz processor and 4GB of storage (that can be supplemented with a micro SD card) as well as running a full Linux OS, making it perfect for collecting the EOD data.

Now I need something to convert the analog EOD signals to digital so that the BeagleBone can process them. For this project I am using the MCP3008 analog to digital converter. Initially, I started by using a cape that had the chip on it.

Analogs, prepare to be converted!

Analogs, prepare to be converted!

The cape worked well for testing the setup with low frequency sine waves, however, the inputs it normally connected to on the BeagleBone were not able to handle the high speed data collection I needed and the data was not being recorded in real time. To work around this issue, I had to individually connect each pin to the appropriate input on the BeagleBone. This lead to the setup appropriately nicknamed “The Shiva”.

Not pictured: the 6 other arms I grew to operate this setup

Not pictured: the additional arms I grew to operate this setup

This setup allowed me to access the programmable real time units (PRUs) on the BeagleBone. PRUs are essentially microprocessors within a microprocessor that sit around eagerly awaiting a program to execute. Unlike the main CPU, the PRUs do not run Linux, allowing them to collect the data in real time. Now that I had my setup I was only missing one thing-the fish! A quick trip to the Electric Fish Lab at MSU and the newest additions to the Backyard Brains Petting Zoo, Tina and Taco, were ready for some data collection.

The one on the right with the goatee is Taco. Tina is on the left

The one on the right with the goatee is Taco. Tina is on the left

I started recording by using the example code from chapter 13 on the Exploring BeagleBone website. The code filled up the PRU memory with data from the recording, and then used another program to read the data from the memory. Although this worked well, it was not what I wanted in terms of a final product. Using the example code as a basis, Stanislav Mircic, Backyard Brains’ ultra-programmer, and I modified it to continuously write the data to a circular buffer as well as simultaneously read the buffer and check if an EOD has occurred.


Now the program will record only the EODs, which is what we are ultimately interested in, instead of all of the raw data. Here’s an example of the output:


Now that I’ve verified what the circuit needs to be, I have to draw out the schematic so that a board can be printed in a form that can snap onto the BeagleBone.

My drawing of the circuit

My drawing of the circuit 

Official Schematic

Official Schematic

And finally the actual board.

Goodbye Shiva!  Only two arms needed for this one.

Goodbye Shiva! Only two arms needed for this one.

For the rest of the summer I will be modifying the circuit design to better suit the goal, such as altering the gain to match the type of recordings we’ll be getting, and preparing the device for field work by building a portable power source and a case that it can float in.  Soon we hope for the device to be picking up lots of fish conversations from around the world!  Stay tuned!