AutomataKit is a collection of reconfigurable open hardware and software for machine-building, process development, and robotics projects.
**Status**
It uses a Distributed Dataflow Programming paradigm: hardware and software objects are all nodes in a graph, executing computing and physical tasks, together!
The project is ongoing. Circuit designs listed here are stable, but software across the board is undergoing a big shift: things are getting better. Currently aiming at March 1 *release* of dataflow-all-the-way-down.
[RuNDMC](https://gitlab.cba.mit.edu/jakeread/rndmc) serves a development environment for those graphs.
## What it Is
The *Distributed Dataflow Machine Controllers* project (pending a decent name) is a collection of reconfigurable open hardware and software for machine-building, process development, and robotics projects.
It uses a Distributed Dataflow Programming Paradigm: hardware and software objects are all nodes in a graph, executing computing and physical tasks, together!
[RuNDMC](https://gitlab.cba.mit.edu/jakeread/rndmc) serves a development environment for those graphs: and Integrated Development and Operation Environment (IDOE).

# Machines Made with These Controllers
This means that *adding and removing hardware to a system is easy, and possible.* It also means that *re-writing machine controllers,* to accept new inputs, or deliver new outputs (material, or feedback) is easy. Machine controllers are transparent: their operating principles are obvious to their users, and so intelligent intervention (and modification!) of controllers is possible. We can re-use algorithms and processes that we have developed across many machine instantiations, and we can build custom systems with less overhead. Tools are pliable again, and under our control.
-[Mother Mother: a Machine Generalist](https://gitlab.cba.mit.edu/jakeread/reich)
@@ -20,20 +30,39 @@ It uses a Distributed Dataflow Programming paradigm: hardware and software objec

Endpoints are designed to be very simple: they receive minimum viable commands and keep minimal state required for operation. This way, system complexity can be organized in the particular application, not distributed throughout the system. For example, steppers receive very simple trapezoid motion segements to execute, and don't do much math except for counting steps.
When I say 'Endpoint' I mean the circuit boards (and computing) we expect to find at the edge of the network that we use to connect each of our modular controllers. I also mean: the modular controllers. These are the circuit boards that you seek.
### Mother Boards
I have started using 'Motherboards' with 'Daughters' - Mother Boards (of which I have only one so far) are home to Computing and Network Hardware: they are the minimum viable package needed to start having a Modular Controller. They feature one 60-pin (with 30 cpu pins connected) 'mezzanine' / 'board-to-board' connector.
Through the 60-pin mezzanine connector mentioned above, I connect the hardware-that-does-work. These are the gate-drivers, mosfets, sensing elements etc, that you need to actually do modular control.
Each of the computers participating in the control of these machines runs a *context* - contexts, while written in different languages and running on different platforms, share a set of messages they can use to describe their internals to one another - and they run the same *execution model* internally. This is the (simple) reconfiguration that allows us to build controllers whose execution can be understood (and modified) cohesively, despite their operation across a network, in physical space.
I call these 'DMCCs' - Distributed Machine Control Contexts. None are ready for use.
[Browser DMCC: the IDOE, aka RuNDMC](https://gitlab.cba.mit.edu/jakeread/rndmc)
[XMEGA DMCC]
# The Network
To make individual motors and sensors modular, AutomataKit endpoints use a port-forwarding, source-routed network. This is *not a bus* and can be connected in a complete graph. All connections are full-duplex and include support for hardware clock synchronization.
To make individual motors and sensors modular, endpoints use a port-forwarding, source-routed network. This is *not a bus* and can be connected in a complete graph. All connections are full-duplex and include hardware for hardware clock synchronization.
Packets typically originate on the network over a usb-to-serial bridge, so you can interface with networked endpoints using any piece of software you can successfully use to open a COM port with: JavaScript, Python etc. The [AutomataKit Router](https://gitlab.cba.mit.edu/jakeread/atkrouter) includes one UBS-to-UART Bridge, which is treated as the 6th port on the router.
Packets typically originate on the network over a usb-to-serial bridge, so you can interface with networked endpoints using any piece of software you can successfully use to open a COM port with: JavaScript, Python etc. The [odb](https://gitlab.cba.mit.edu/jakeread/odb) includes one UBS-to-UART Bridge, for very simple interface. [XMEGA Motherboard](https://gitlab.cba.mit.edu/jakeread/motherboard-xmega) and XMEGA DMCC will offer a USB serial link.
The hardware (or 'PHY' layer) of the network is simple UART. That means that all the network is, is a few UART links between microcontrollers, and some C code that listens for incoming packets and forward messages according to the instructions in the packet. Critically, there are not *addresses* in the network, instead, packets themseleves carry routes: this is 'source routing' in network nomenclature.
...
...
@@ -49,20 +78,6 @@ Bytes between the Length Byte and the *Packet Header End Delimiter* define the r
So far, the endpoints all have xmega microcontrollers at their heart. In particular, the ```XMEGA256A3U``` : the biggest, baddest xmega. We clock it at 48MHz. That said, this isn't a requirement - any microcontroller with a UART port can play.
Firmware can be found in each board's repository under the ```embedded/``` directory. Build, run and debug via the instructions [here](reproduction/firmware.md), or roll your own toolchain.
Packet handling is like this: [uartports](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard/blob/master/embedded/atkbbb/atkbbb/uartport.c) handle interrupts that pull incoming data into [ringbuffers](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard/blob/master/embedded/atkbbb/atkbbb/ringbuffer.c). These are scanned [with this structure](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard/blob/master/embedded/atkbbb/atkbbb/atkport.c) and then handled [with this one](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard/blob/master/embedded/atkbbb/atkbbb/atkhandler.c). Global things are kept in [this include file](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard/blob/master/embedded/atkbbb/atkbbb/hardware.h).
All in, probably there is too much pointing->through->things, as I understand this takes a cycle on each link.
As for DMA, the XMEGA has only four channels (if I understand correctly) so unless I get my hands dirty doing channel-management, the router isn't going to work (it has 6 ports, plus a usb link).
# Usage
## Wiring
...
...
@@ -114,10 +129,3 @@ Once you've gotten your hands on / or built some ATK Hardware, you'll need to lo
If you'd like to make your own hardware for the network, I recommend using the [ATKBreadBoardBoard](https://gitlab.cba.mit.edu/jakeread/atkbreadboardboard) whose documentation also includes a 'daughter' board starter - this will let you plug some new circuitry right onto the available XMEGA pinouts, and use known-to-work programming, voltage regulation, and network interface hardware.
Along with this note, there's more detailed explanation in the link above.
\ No newline at end of file
# Development Notes
- the push now is to find backpressure in the network, and go for a four wire
- also / in that case, a router board with dma access (x usb on each chip) and maybe a rethink of the headboard / daughter lookout ... face-to-face so that single sided PNP is possible (usb on same side ... nice to port-in wherever) ... port on the 'other side' then ? or also on same side and SMD ?