This project is about a usage counter for the laser cutter at revspace.
Currently, the original purchase cost of the laser cutter is recouped by asking E2,50 per 15 minutes of usage. People have to keep track of time themselves, it is not very fine-grained and this cost-model does not take into account how intensive the laser cutter is actually used.
A laser cutter usage counter can improve this situation as follows:
- keep track of usage time per cutting session, for example show the time since power-up on a display
- count usage in smaller units of time (e.g. 1 minute instead of 15 minutes)
- account for the actual usage per time unit, for example count usage in proportion to laser power (the assumption is that using lower power produces less wear on the laser tube, which means longer life).
Additional features could be:
- directly calculate a price instead of just showing time
- keep track of various other interesting usage counters (a bit like SMART does for disks), for example:
- on-time (this session)
- on-time (lifetime total)
- minutes of laser on-time (this session)
- minutes of laser on-time (lifetime total)
- effective minutes of laser on-time (time x power) (this session)
- effective minutes of laser on-time (time x power) (lifetime total)
- number of times the laser cutter was powered up
- publish the usage counters, e.g. on our mosquitto topic over the revspace wireless NRF network
- a configuration interface to set parameters (e.g. price/minute)
The laser cutter usage counter functionally consists of the following parts:
- a display to show the current session time (among other things)
- a button to reset the current session
- an electrical front-end to measure whether the laser tube is on, and at what power it is operating
- an arduino that controls all of this, which also implements:
- a clock to keep track of time (arduino internal clock)
- non-volatile memory to store usage counters (arduino internal EEPROM)
The laser cutter has three wires we can interface with:
- 5V, this could possibly also be the power source for the usage counter
- PWM, the laser tube intensity signal
Probably a low-pass filter is needed to average the PWM-signal before measuring it.
TODO: figure out the PWM rate of our laser controller.
TODO: determine a suitable sample rate for the current power (e.g. once per second).
Probably a standard 2-line 16 character display can be used. We could use one line for the current session counters and the other line for lifetime total counters.
The button is a push button. Pressing it causes the session counters to be reset back to zero. The lifetime counters are never reset.
An arduino nano or mini pro is likely sufficient.
The internal timer is used as a time base, probably accurate within 100 ppm.
The internal EEPROM is used for storage of the counters. By using a smart wear-leveling mechanism, the lifetime of the EEPROM can be stretched to several 100 thousands of operating hours, which should be sufficient (longer than the laser tube lifetime).
The wear-leveling algorithm works by storing the data to be persisted in a different location every time. For example, if we have 16 bytes to store, we can define 64 slots in the arduino 1kB EEPROM. Each slot contains a sequence number and a checksum.
When reading, we read all slots and select the slot which has the highest sequence number and a valid checksum. The checksum ensures that a half-written slot can be detected (e.g. when a power-down/crash occurred during writing). An invalid slot can be skipped this way, and we automatically fall back the slot before it. When writing, we simply write to the next slot than we one we read from, using a higher sequence number.
Assuming a write frequency of once per minute, it takes about 64 * 100,000 writes before the EEPROM reaches its official limit, this amounts to about 100k hours.