Difference between revisions of "Hybrid Computer"

From TheAnalogThing
 
(7 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
[[Category:Fundamentals]]
 
[[Category:Fundamentals]]
 +
 +
== THAT Hybrid Port ==
 +
For a manual of the Hybrid Port see [[:File:THAT hybrid port desc.pdf]].
 +
 +
<gallery>
 +
  File:HybridPort.png|Naming/mapping of THAT Hybrid port
 +
  File:THAT hybrid port desc.pdf|Descriptive manual of THAT Hybrid port
 +
</gallery>
 +
 +
=== THAT Hybrid Port Logic Levels ===
 +
 +
The hybrid port logic levels are ''CMOS'', i.e. compatible with Rasberry Pi, modern Arduinos, ESPs, Teensys, etc.
 +
In general, TTL and LVTTL, LVCMOS are compatible in case of low load. See https://www.ti.com/lit/sg/sdyu001ab/sdyu001ab.pdf?ts=1704181296942 for a good overview of logic families and their compatibility.
 +
 +
== A simple Arduino based hybrid controller for THAT ==
  
 
[[File:Hc_setup.jpg|center|500px]]
 
[[File:Hc_setup.jpg|center|500px]]
Line 32: Line 47:
  
 
[[File:Arduino_hc.jpg|center|500px]]
 
[[File:Arduino_hc.jpg|center|500px]]
 +
 +
(As tempting as it may be to power THE ANALOG THING by the 5V line of the Arduino - this does not work since the current requirement of the THAT is too high at about 300 mA which causes a substantial voltage drop, leaving only about 4.4 V at THE ANALOG THING which is not quite enough for correct operation. Thus, THE ANALOG THING should always be powered by a dedicated power supply with a USB-C cable while the Arduino is powered by its own USB-connection to the host computer.)
 +
 +
=== Software ===
 +
 +
The required software for this hybrid controller can be found at [https://github.com/anabrid/hardware/blob/main/the-analog-thing/arduino_2650_hybrid_controller/simple_hybrid_controller/simple_hybrid_controller.ino]. It requires two additional libraries, TimerThree and TimerFive, to compile. These two timer libraries are necessary for the accurate timing of operating modes and data logging and must be installed for your Arduino IDE before compiling the source.
 +
 +
=== Commands ===
 +
 +
* arm: Arm the data logger. Data logging can be performed during a single run (see below) and will automatically start when the logger has been armed before starting the single run. After completing the single run, the logger is disarmed again.
 +
* channels=value: Set the number of analog channels to be logged. The value can range between 1 and 4.
 +
* disable: Disable the hybrid controller. This is the normal startup mode; THE ANALOG THING will work as a standalone analog computer when the hybrid port is disabled.
 +
* enable: Enable the hybrid controller. In this case, THE ANALOG THING is is under control of the attached microcontroller and the mode switch is disabled.
 +
* halt: Put THE ANALOG THING into HALT-mode.
 +
* help: Print a short help text.
 +
* ic: Set THE ANALOG THING to IC-mode.
 +
* ictime=value: Set the IC-time to value milliseconds. This is necessary for any single or repetitive run. Typically the duration of IC-mode is a few milliseconds. (If there are any integrators in an analog program with their time scale factor set to SLOW, the IC-time should be high enough so that these integrators can settle to the selected initial condition.)
 +
* interval=value: Set the sampling interval for the data logger to value milliseconds.
 +
* op: Set THE ANALOG THING to OP-mode.
 +
* optime=value: Set the OP-time to value milliseconds.
 +
* rep: Start repetitive operation. THE ANALOG THING will from now on cycle between IC and OP with the respective times set by the ictime and optime commands. Repetitive operation is ended when the computer is explicitly set into IC-, OP- or HALT-mode.
 +
* run: Start a single run with the IC- and OP-phase duration determined by the times set with the ictime and optime commands. Only during such a single run data logging is possible.
 +
* status: Return status information.
 +
 +
=== Typical operation ===
 +
A typical sequence of commands to run an analog program once while collecting
 +
data looks like this:
 +
 +
ictime=50
 +
optime=3000
 +
interval=5
 +
channels=1
 +
arm
 +
enable
 +
run
 +
 +
This will print the AD converted values during the single run. These can then
 +
be copied to a file (by copy/paste) and plotted with gnuplot or the like.
 +
 +
The analog program shown in the picture at the beginning is a Hindmarsh-Rose model of a bursting and spiking neuron. [https://analogparadigm.com/downloads/alpaca_28.pdf] Plotting the data captured with the sequence of commands shown above with gnuplot yields a result like this:
 +
 +
[[File:Hindmarsh_rose_x.jpg|center|500px]]

Latest revision as of 12:29, 4 January 2024

A hybrid computer is a computer consisting of an analog computer and a digital computer. The two worlds are connected with ADCs/DACs (analog to digital/digital to analog converters).

THAT Hybrid Port

For a manual of the Hybrid Port see File:THAT hybrid port desc.pdf.

THAT Hybrid Port Logic Levels

The hybrid port logic levels are CMOS, i.e. compatible with Rasberry Pi, modern Arduinos, ESPs, Teensys, etc. In general, TTL and LVTTL, LVCMOS are compatible in case of low load. See https://www.ti.com/lit/sg/sdyu001ab/sdyu001ab.pdf?ts=1704181296942 for a good overview of logic families and their compatibility.

A simple Arduino based hybrid controller for THAT

Hc setup.jpg

This section describes a simple yet quite powerful hybrid computer consisting of THE ANALOG THING and an attached Arduino Mega 2650 micro controller board. Since THE ANALOG THING features a dedicated connector for attaching an external digital computer, only a few connections between this HYBRID connector and the Arduino are required to setup the hardware:

Caption text
HYBRID pin description destination on Arduino
2 analog x output AnalogIn 0
4 analog y output AnalogIn 1
6 analog z output AnalogIn 2
8 analog u output AnalogIn 3
9+10 GND GND
13 enable hybrid mode D2
14 MOP D3
16 MIC D4

These connections were made using a piggy back board suitable for an Arduino Mega 2650 which only contains a 2x8 pin header and the connections listed in the above table:

Arduino hc.jpg

(As tempting as it may be to power THE ANALOG THING by the 5V line of the Arduino - this does not work since the current requirement of the THAT is too high at about 300 mA which causes a substantial voltage drop, leaving only about 4.4 V at THE ANALOG THING which is not quite enough for correct operation. Thus, THE ANALOG THING should always be powered by a dedicated power supply with a USB-C cable while the Arduino is powered by its own USB-connection to the host computer.)

Software

The required software for this hybrid controller can be found at [1]. It requires two additional libraries, TimerThree and TimerFive, to compile. These two timer libraries are necessary for the accurate timing of operating modes and data logging and must be installed for your Arduino IDE before compiling the source.

Commands

  • arm: Arm the data logger. Data logging can be performed during a single run (see below) and will automatically start when the logger has been armed before starting the single run. After completing the single run, the logger is disarmed again.
  • channels=value: Set the number of analog channels to be logged. The value can range between 1 and 4.
  • disable: Disable the hybrid controller. This is the normal startup mode; THE ANALOG THING will work as a standalone analog computer when the hybrid port is disabled.
  • enable: Enable the hybrid controller. In this case, THE ANALOG THING is is under control of the attached microcontroller and the mode switch is disabled.
  • halt: Put THE ANALOG THING into HALT-mode.
  • help: Print a short help text.
  • ic: Set THE ANALOG THING to IC-mode.
  • ictime=value: Set the IC-time to value milliseconds. This is necessary for any single or repetitive run. Typically the duration of IC-mode is a few milliseconds. (If there are any integrators in an analog program with their time scale factor set to SLOW, the IC-time should be high enough so that these integrators can settle to the selected initial condition.)
  • interval=value: Set the sampling interval for the data logger to value milliseconds.
  • op: Set THE ANALOG THING to OP-mode.
  • optime=value: Set the OP-time to value milliseconds.
  • rep: Start repetitive operation. THE ANALOG THING will from now on cycle between IC and OP with the respective times set by the ictime and optime commands. Repetitive operation is ended when the computer is explicitly set into IC-, OP- or HALT-mode.
  • run: Start a single run with the IC- and OP-phase duration determined by the times set with the ictime and optime commands. Only during such a single run data logging is possible.
  • status: Return status information.

Typical operation

A typical sequence of commands to run an analog program once while collecting data looks like this:

ictime=50
optime=3000
interval=5
channels=1
arm
enable
run

This will print the AD converted values during the single run. These can then be copied to a file (by copy/paste) and plotted with gnuplot or the like.

The analog program shown in the picture at the beginning is a Hindmarsh-Rose model of a bursting and spiking neuron. [2] Plotting the data captured with the sequence of commands shown above with gnuplot yields a result like this:

Hindmarsh rose x.jpg