summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 6bdab4bffa5af626e376088a921be3334f6718b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ATmega Engine Controller
========================

The code from firmware/ is supposed to run on a ATmega48
sending servo signals to cheap brushless controllers as used
in RC models. The ATmega48 gets its instructions via a serial
line from a host system. The code in client/ is a small test
binary for the host system.

Connection
----------------

	[Engine 1]--->[BLC 1]--->PB1
	[Engine 2]--->[BLC 2]--->PB2
	[Engine 3]--->[BLC 3]--->PB3
	[Engine 4]--->[BLC 4]--->PD3
	[Engine 5]--->[BLC 5]--->PD5
	[Engine 6]--->[BLC 6]--->PD6

	[Host TX]--->PD0
	[Host RX]--->PD1

Serial Protocol
---------------

Each of the following commands will be acknowledged with
```0x2E```, which is the ASCII value for a dot. Available
commands are:

- **no operation**

	This command simply does nothing. It consists of a
	single byte: ```0x00```

- **enable**

	Sending the bytes ```0xCA```, ```0xFE```, ```0xBA```, ```0xBE``` activates
	the engine controlling. Before sending this command
	the controller does not activate any engine.

- **disable**

	One can disable all engines again by sending the
	bytes ```0xDE```, ```0xAD```, ```0xBA```, ```0xBE```. After disabling the
	engines with this command all future engine settings
	will be ignored.

- **set speed (of a single engine)**

	To set the speed of a single engine on has to send
	two bytes: first the engine number in the system
	(```0x01``` - ```0x06```), the the desired speed (```0x00```-```0xFF```).

- **set speed of all engines simultaneously**

	One can also set the speed of all engines simultaneously
	to the same value by first sending ```0xFF``` and then sending
	a second byte with the desired speed (```0x00```-```0xFF```).