Arduino


Arduino Uno is a simple microcontroller circuit board which is used by many inventors and experimentalists. The board has a logic chip and 16 analog and digital input or output pins.

It connects to a computer with USB port and can be loaded with a program to control the inputs and outputs.

LED String

For our neuroscience investigation it  can be connected to a series of LED lights which light up in a series based on the output from a Spiker Box which serves as an amplifier. The basic circuit can be built on  breadboard as follows.


Digital pins 2-12 each go to a separate LED, to the positive leg (long leg) and then from the short LED leg to ground by way of  resistor to limit the voltage and not burn out the LED.

Analog input pin A0 goes to a diode (to pass only the positive spikes)  to the spiker output, to a variable resistor and then to +5V. 

The Arduino is controlled in a computer language built on "Processing".  The routine is called a sketch
Load the Arduino program attached below


How it works
The Spiker box produces an audio signal of the clicks of nerve firings from the cockroack leg. The audio signal is a fluctuating voltage from -50 millivolts to +50 mv.  The diode passes only the positive spikes to the arduino. The variable resistor allows you to adjust the input signal so that you can zero out the background level so that no lights come on when the leg is not stimulated, even though it is still producing a low clicking noise. When you stimulate the cockroach leg the frequency and intensity of the nerve firings increase. This is registered as an increasing voltage on the analog input pin. The program then lights up a each LED in series according to a series of defined voltage intervals.

Beat Counter

Another more sophisticated project is to build a complete spike counter using an LCD keypad shield. The shield fits directly on top of the arduino and the keypad controls the menus and functions. The input from the amplified audio output of the spiker box goes to A1 and Ground on the lower right of the shield.

M0 is the main menu where sampling happens. Press Select button on the shield to sample for a preset duration. An letter "R" appears to the left of the word Trial while sampling is happening. The Trial number is incremented and the number of pulses that were above the threshold level are counted. Press the UP and Down button to move between the menus.


M1 is the threshold trigger voltage. The number is relative to the analog port of the devices and is not strictly calibrated to a real voltage. With a sample signal incoming you can select the threshold with the Left and Right buttons while watching the upper right corner of the display for an asterisk. This means a signal has been received above the trigger voltage. The Max is the highest measurement in the last second. The average is an progressive average of the last 100 measurements. You can adjust the power of the amplified signal coming into the device and adjust the voltage that it triggers.


M2 is the sampling period in milliseconds. Click Left or Right buttons to change.

M3 is the debounce period. After making a triggering measurement the device waits for this period of millliseconds before making another measurement. This prevents the device from counting multiple spikes from the same event due to lags in the system. Click Left or Right buttons to change.



Load the Arduino sketch for this device.

Here is where you can order the Sain LCD Shield

As with any electronic device that measures small currents noise is a ongoing issue. When you connect your amplifier to the Spiker list to the signal and see if you can arrange or shield the wires so any loud buzzes are eliminated.

Driving Devices

Driving Low Power Devices
The output pins on the Arduino are low power, less than 40 milliamps at 5volts. This is enough to brightly light an LED (with resistor) or other low power devices such as a tiny buzzer. We connected a buzzer to pin 8 of the circuit described above so that it beeps when that output is triggered. This gives you an auditory as well as a visual clue that the input voltage from the spike has reached that level. If you try to connect multiple LEDS or large current draw like a motor on the output pin you risk burning out the arduino board.

Driving High Power Devices
More power hungry devices can be controlled using an external power supply and an additional transistor in the circuit.  The transistor acts as a switch or relay and that turns on an external power supply. Lets say you want to run a 12 volt motor that draws 500 milliamps.
  1. Get a NPN-type transistor called a TIP120, or other transistors with suitable power rating. Identify the base, collector and emitter (this order changes depending on the brand of transistor).
  2. Connect the Base to one of the output pins of the arduino through a 1-2K resistor to limit the current.
  3. Connect the Emitter to ground
  4. Connect the Collector to the negative supply to the device you are trying power.
  5. Connect your external power supply to ground.
  6. Connect the positive side of your external power supply to the positive side of the device you are powering.

Here's how it works. When the pin you are testing goes to +5volts it is sensed by the base of transistor which allows current to flow between the collector and the emitter. This current is whatever is supplied by the external power supply. Thus the current supplied by the output pin only has to turn a transistor on and off which controls a much larger current that doesn't go through the arduino. You can use this to turn on a motor or to flash a bigger light or string of LEDs. It only works with DC so never connect AC to this. Also this is still pretty low power so you will have to use a heavy duty transistor or relay for a larger device.

Links

Wikipedia on Arduino

Arduino Website


ą
Shaun Taylor,
Nov 30, 2012, 10:17 AM
ą
Shaun Taylor,
Nov 30, 2012, 10:17 AM
ą
Shaun Taylor,
Nov 30, 2012, 10:17 AM
ą
Shaun Taylor,
Nov 30, 2012, 10:17 AM
ċ
ledstring.ino
(2k)
Shaun Taylor,
Jul 9, 2012, 11:00 AM
ċ
roachcounter_sain.ino
(7k)
Shaun Taylor,
Nov 30, 2012, 10:12 AM
Comments