README: document project
This commit is contained in:
parent
925c020c16
commit
f858253f78
100
README.md
100
README.md
|
@ -1,34 +1,65 @@
|
|||
This firmware template is designed for development boards based around [STM32 F1 series micro-controller](http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1031).
|
||||
|
||||
project
|
||||
=======
|
||||
|
||||
summary
|
||||
-------
|
||||
|
||||
*describe project purpose*
|
||||
this clock jockey monitors the tachometer of a motor turning a clock, and regulates its speed by switching the power to it.
|
||||
|
||||
technology
|
||||
----------
|
||||
|
||||
*described electronic details*
|
||||
the goal was to make a round clock quadrant turn.
|
||||
the quadrant is made out of wood, around 1 m heigh, and weights around 5 kg.
|
||||
it is mounted on a disco ball base.
|
||||
the bearing is strong enough to hold it and allow the clock to turn around its center.
|
||||
|
||||
originally the disco ball base included a motor, but it was too fragile to withhold the forces.
|
||||
two plastic gears in the gear box broke.
|
||||
this was the state of the clock when I joined the team.
|
||||
I decided to fix the turning clock.
|
||||
the small DC or stepper motor I tried were too weak to turn the clock.
|
||||
I decided to use a universal motor salvaged from a washing machine.
|
||||
|
||||
the pinout of the motor was undocumented, but not hard to figure out.
|
||||
two wires went to a small module at the end of the rotor shaft.
|
||||
this is the tachometer to measure the rotation speed.
|
||||
it is also easy to trace the two wires going to the brushes feeding the power to the rotor coils.
|
||||
next, measure the resistance of the remaining pin pairs.
|
||||
one will have 0 Ohms.
|
||||
this is the fuse to protect against over-heating.
|
||||
there will be two pairs of 0.6 Ohms, and one of 1.2 Ohms.
|
||||
these are the two coils for the stator, with a center tap.
|
||||
|
||||
wire the motor with 220V AC the following way:
|
||||
AC L - fuse - rotor - stator (2 coils, not center tap) - AC N
|
||||
to limit the speed I used a 4000 W capable SCR.
|
||||
the SCR was not enough to regulate the motor speed.
|
||||
setting the potentiometer to a fixed point would results in the motor to stop turning after some time, of to speed up to fast.
|
||||
the user would have to adjust the potentiometer using then knob periodically to have a somewhat constant speed.
|
||||
|
||||
to overcome this limitation I developed the clock jockey.
|
||||
this device will monitor the speed of the motor using the tachometer, and switch the power to the motor using a Solid State Relay (SSR), so to reach and stay at the predefined speed.
|
||||
|
||||
the motor tachometer provides an AC signal.
|
||||
basically it's a generating motor linked to the shaft of the actual motor.
|
||||
the AC frequency (and voltage) indicates the speed of the motor.
|
||||
the AC signal is rectified using a full bridge rectifier.
|
||||
the rectified signal is input to an PC817 optocoupler (with ~ 200 Ohm inline resistor).
|
||||
the full bridge rectifier protects to optocoupler, which has a reverse breakdown voltage of 6 V, lower than the seen -10 V peaks of the AC signal.
|
||||
it also allows to get two pulses per AC period, for a more accurate speed measurement.
|
||||
the optocoupler is directly connected to the clock jockey.
|
||||
an omron G3MB-202P (5V) is also connected to the clock jockey to switch to power going to the motor.
|
||||
the SCR is still in line to limit the maximum delivered power.
|
||||
|
||||
board
|
||||
=====
|
||||
|
||||
The current implementation uses a [core board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board).
|
||||
the device reuses an [ST-LINK/V2 clone](https://wiki.cuvoodoo.info/doku.php?id=jtag#mini_st-link_v2).
|
||||
this board uses a STM32F103C8T6 micro-controller.
|
||||
|
||||
The underlying template also supports following board:
|
||||
|
||||
- [Maple Mini](http://leaflabs.com/docs/hardware/maple-mini.html), based on a STM32F103CBT6
|
||||
- [System Board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#system_board), based on a STM32F103C8T6
|
||||
- [blue pill](ihttps://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill), based on a STM32F103C8T6
|
||||
- [core board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board), based on a STM32F103C8T6
|
||||
- [ST-LINK V2 mini](https://wiki.cuvoodoo.info/doku.php?id=jtag#mini_st-link_v2), a ST-LINK/V2 clone based on a STM32F101C8T6
|
||||
- [USB-Blaster](https://wiki.cuvoodoo.info/doku.php?id=jtag#armjishu_usb-blaster), an Altera USB-Blaster clone based on a STM32F101C8T6
|
||||
|
||||
**Which board is used is defined in the Makefile**.
|
||||
This is required to map the user LED and button provided on the board
|
||||
since the device is firmware protected (against read-out), you will first need to remove this protection using an SWD adapter and running `rake remove_protection`.
|
||||
you can then flash the bootloader using SWD and application using DFU a documented in the section below.
|
||||
|
||||
The ST-LINK V2 mini clone has SWD test points on the board.
|
||||
Because read protection is enabled, you will first need to remove the protection to be able to flash the firmware.
|
||||
|
@ -44,11 +75,34 @@ Now you can remove the read protection (and erase flash), run `rake remove_prote
|
|||
connections
|
||||
===========
|
||||
|
||||
Connect the peripherals the following way (STM32F10X signal; STM32F10X pin; peripheral pin; peripheral signal; comment):
|
||||
connect the peripherals the following way:
|
||||
|
||||
- *list board to preipheral pin connections*
|
||||
- PC817X emitter, SWIM pin (PB11, pulled up to 3V3 on board)
|
||||
- PC817X collector, GND
|
||||
- G3MB-202P SSR 3+, 5V (5V required by SSR, with embedded resistor)
|
||||
- G3MB-202P SSR 4-, SWDIO (SWCLK pin in not 5V tolerant)
|
||||
|
||||
All pins are configured using `define`s in the corresponding source code.
|
||||
all pins are configured using `define`s in the corresponding source code.
|
||||
|
||||
usage
|
||||
=====
|
||||
|
||||
the firmware will simply count the number of optocoupler falling edges (2 per revolution).
|
||||
it will periodically compare this count to the target value.
|
||||
if this is below, the SSR will be switched on.
|
||||
if it is above, the SSR will be switched off.
|
||||
|
||||
to set this target, connect the clock jokey to a computer.
|
||||
it will appear as a serial device (using the CDC ACM USB profile).
|
||||
use a serial terminal program and connect to it (the baud rate does not matter).
|
||||
enter `tacho xx`, with xx being the target tachometer count.
|
||||
to view the set and current tachometer values, enter `tacho`.
|
||||
|
||||
the target tachometer count is somewhat relative.
|
||||
it is proportional to the motor speed and tied to the periodic check (currently set to 0.1 s).
|
||||
|
||||
if the tacho count it at 0 for too many seconds after boot, the clock jockey will with off the power.
|
||||
this is a safety feature since the tachometer is either not reading the speed, or the motor is stuck.
|
||||
|
||||
code
|
||||
====
|
||||
|
@ -86,7 +140,7 @@ The `Makefile` uses a Black Magic Probe (per default), or a ST-Link V2 along Ope
|
|||
To flash the `booltoader` using SWD run `rake flash_booloader`.
|
||||
|
||||
Once the `bootloader` is flashed it is possible to flash the `application` over USB using the DFU protocol by running `rake flash`.
|
||||
To force the bootloader to start the DFU mode press the user button or short a pin, depending on the board.
|
||||
To force the bootloader to start the DFU mode, short the RST pin to the nearby ground pin.
|
||||
It is also possible to flash the `application` image using SWD by running `rake flash_application`.
|
||||
|
||||
debug
|
||||
|
@ -98,8 +152,4 @@ To start the debugging session run `rake debug`.
|
|||
USB
|
||||
---
|
||||
|
||||
The firmware offers serial communication over USART1 and USB (using the CDC ACM device class).
|
||||
|
||||
You can also reset the board by setting the serial width to 5 bits over USB.
|
||||
To reset the board run `rake reset`.
|
||||
This only works if provided USB CDC ACM is running correctly and the micro-controller isn't stuck.
|
||||
The firmware offers serial communication over USB (using the CDC ACM device class).
|
||||
|
|
Loading…
Reference in New Issue