Building a Control System with Neurons

I built a balancing control system with electronic neuron simulators (NeuroBytes). It actually works pretty well!

Jarod White
7 min readMar 29, 2018

Background and Motivation

About a year ago, I joined the team at NeuroTinker to help build an open source hardware platform for teaching people about neurons. Our platform, called NeuroBytes, is an ecosystem of electronic neuron simulators that each replicate a type of real biological neuron, but are also simple and easy to use so that you can play around with them on a tabletop — it’s basically like LEGO for neurons. Our goal is to not only teach you how neurons work, but also enable you to use those concepts to design and build cool neural circuits.

The current lineup of NeuroBytes neuron simulators. Each board behaves like a different type of neuron.

As an electrical engineer by training, one of the projects I’ve been most excited to build with NeuroBytes is a control system. Building a properly tuned control loop is actually pretty difficult and requires real-time arithmetic, numerical integration, and careful selection of tuning parameters. Yet, somehow, biological organisms are able to perform the function of a control system without ever consciously doing any math or even knowing control systems theory! Whether it be a human (with 80 billion neurons) applying the brakes in their car to stop just before a stoplight, or a roundworm (with 300 neurons) bending and flexing around to explore its environment, organisms are able to accomplish complicated control behavior with just neural circuits.

The Fan Balancer

To get a feel for what a control system might look like in a neural circuit, we first need a simple test system that can be controlled with one input and has just one output for the circuit to sense.

What we came up with was this weird, propeller-attached-to-a-see-saw thing pictured below. We call it the ‘fan balancer’ because it works by controlling a fan’s speed to balance an arm at a particular position.

[IMG 1 fan balancer]

To get a baseline for what control behavior looks like with this system, I tried controlling the fan myself with just a button to adjust the fan speed.

It’s not too hard to keep the arm balanced at one position but getting to a particular position requires some finesse.

Control Techniques

There are two basic control techniques that I find myself doing here:

  1. I increase or decrease the fan speed based on how far away it is from the desired position. (e.g. If the fan is at the bottom and I want it at the top, then I increase the fan speed a lot. If it’s just slightly below where I want it, then I increase it just a little bit.)
  2. The longer the fan stays away from the desired position, the larger the correction I make to the fan speed.

In control system theory, that first technique is called proportional control and the second technique is called integral control.

Really though, these concepts are common sense. If you are driving and the stoplight you’re approaching turns red, you’ll press the brakes really hard if you’re going 50 mph, but only press the brakes slightly if you’re going 20 mph (i.e. proportional control). As well, if you press on the brakes but your car doesn’t start slowing down fast enough, then you’ll probably start pressing the brakes much harder (i.e. integral control).

Before we start trying to replicate this behavior with a neural circuit, let’s introduce some of the basic components of a neural circuit. This isn’t a complete introduction to neural networks or neuroscience, but it should give you a good idea of what’s going on.

A Short Primer on Neural Circuits

There are three main kinds of neurons:

  1. Sensory neurons — which respond to external stimulus like touch or sight by sending stimulus (an electrical pulse) to other neurons
  2. Motor neurons — which receive impulses from other neurons to trigger a response, like muscle contraction
  3. Interneurons —which receive and send impulses. Lots of interneurons connect together to create emergent behavior like memory.

Neurons communicate with each other by sending all-or-nothing electrical pulses called action potentials (APs for short). When a neurons receives an impulse on an input, it gets an increase in its internal electrical potential. Once an interneuron’s potential exceeds a threshold, it fires its own AP through its outputs. If an interneuron receives impulses but its potential doesn’t exceed the threshold, it still won’t fire and eventually its potential will decay back to resting potential.

Motor neurons are slightly different from interneurons because they only receive inputs and are able to translate their potential into physical motion. As an example, here is the circuit I was using to control the fan balancer.

The circuit has two neurons: a sensory neuron (left) with a button and a motor neuron (right) controlling the fan speed. The sensory neuron sends a pulse to the motor neuron when the button is pressed (or lots of pulses if it is held down). The motor neuron’s potential increases when it receives a pulse and decays back to zero eventually if it doesn’t receive more. The motor neuron’s potential is mapped to the fan speed (higher potential = faster fan).

The video below uses the same manual control circuit but this time includes a synchronous view of the circuit and the motor’s potential (blue graph).

The motor neuron is rapidly receiving impulses from the button, but potential spikes form because its potential is also decaying. You might also see that when I press the button at a constant rate, a roughly constant potential appears on the motor neuron. This is because the potential increase from the impulse is matched by the potential decay between button presses.

This is actually pretty useful because it means that, by sending pulses to the motor neuron at different rates, we can effectively control the motor neuron’s potential, and thus the fan’s speed (and eventually position), with another neuron’s firing rate. For instance if we have a neuron that’s firing at a slow rate and connect it to the motor neuron, then the motor neuron will similarly have a relatively low average potential. Likewise, connecting a fast firing neuron to the motor neuron will give the motor neuron a relatively high average potential because there is less time for the potential to decay between impulses.

Designing the Control Circuit

Our goal is to get the person out of the equation and control the position of the arm with just a neural circuit. The control circuit should also be able to move the arm from wherever it happens to be to a desired position just by controlling the fan.

Proportional Control

We can start by implementing just simple proportional control. To do this, we need the circuit to be able to tell how close or far the position of the arm is to its desired position. The arm position is read using a sensory neuron that fires faster the higher the arm is positioned. Thus, the firing rate of the sensory neuron maps to arm position. To represent the desired fan position, we use a constantly firing neuron that sends pulses at a constant frequency (the frequency is adjustable via a touch sensor).

The sensory neuron is connected to the motor neuron via a blue inhibitory cable. This just means that it’s pulses have a negative effect and cause the potential of the motor neuron to actually decrease when it receives a pulse. Pulses from the set point neuron add to the motor neuron’s potential while pulses from the sensory neuron subtract. This way the motor neuron has a potential that is proportional to the difference between the desired and the actual arm positions. When the arm is in the desired position, both signals should cancel out and the motor neuron will have zero average potential.

Let’s see if it works!

The circuit can definitely keep the arm balanced in one position, but, you’ll notice that when i knock it away from its steady-state position, it returns to a different steady-state position. This isn’t as good as a human operator who is able to return the arm to the same position every time, no matter which direction or how hard it’s knocked away from it.

Integral Control

To accomplish that, let’s add the second type of control, integral control. The basic idea here is just that the longer the sensed arm position is away from its desired position, the stronger the correction should be.

Interneurons have a small propagation delay when they send pulses downstream so, by using a few of them, we should be able to build a loop that slowly increases its firing firing rate in response to the error signal.

The integrating neuron starts firing when there is positive error (arm below the desired value). We want to excite the motor neuron more the longer the arm stays below the desired position — so we connect the output of the integrating interneuron to a motor neuron input.

This pretty much accomplishes what we set it to do! The neural circuit is able to balance the fan at a particular position and, when perturbed away from it, return back to the same position. It’s just like people!

Coming Soon…

In future posts, I’ll show how learning techniques like Hebbian learning and back-propagation can be used to make the control system circuit self-tuning. We’ll also look at some other neural control system circuits like a self-balancing robot.

Interested in building your own neural circuits? Checkout NeuroTinker.com for info on

--

--