Hi folks. New to Arduino and this forum! Not looking to be spoon fed though, Already got my arduino driving a 16x2 LCD and a quad relay bank. I'm pretty chuffed I got this far without asking for any assistance just by reading and playing.
The plans for my arduinos are:
1. Control an ion laser
2. Control a BPSK31 beacon transmitter
3. Control some lights over DMX
OF course these projects are not all to be covered in this topic. This topic is about the ion laser.
I'm planning to use a duemilanove to control this laser using the following peripherals:
a 4x20 LCD screen
a series of press buttons (resistor network)
a stepper motor driving a 25t trimpot (poor mans digipot)
a set of relays for sequencing
a pair of voltage dividers to sense tube power and tube current.
So far I have got my Arduino to run the screen and chase the relays. This was self learning, reading and playing with code to make the relays turn on and off for one seconds in sequence, and display the currently powered relay on the screen.
Heres a You tube clip of the result:
So far so good. My first arduino program after "hello world" and "blink a led".
The project I am constructing with the arduino needs to do the following:
1. Read the eeprom and put these values aside for limits, and configuration data
2. Display a menu
3. Listen for press buttons
4. Monitor the voltage dividers
5. Sequence the relays when commanded to start the laser
6. Rotate the stepper when commanded to increase or decrease the lasers power.
Point 1 is fairly simple - read each eeprom value and store it in a variable for later use in the program (e.g. maximum tube current, maintenance burn timer value, head hours)
Point 2 is a pain. The menu has the following structure:
+ Normal Run
+ Maintenance Burn
+ Test Mode
Function 1 starts the laser, and is a normal run, allowing the user to adjust power, set ilde/run mode, Light/Current mode, etc
Function 2 starts the laser, sets the power to midrange, and counts down the burn time. Once it reaches 5 minutes to go, it idles the lasers, then shuts it off. Argon lasers function best when they are run once a month. This menu item automates this.
Function 3 allows the user to enter the particulars of their lasers such as maximum safe tube current, how long they want the default maint burn time to be, what the hour meter on the head reads (it can be hard to get at, so being able to see it on the controller makes life easy), and other configuration parameters.
Function 4 allows the operator to test the arduino without a laser connected - cycling the relays, checking the voltage dividers etc.
Point 3 is easy. Use an analoge pin and buttons on a voltage divider string to pass button presses to the controller
Point 4 is also fairly easy but I suck at maths. A voltage divider converts the analogue 15v scale of the lasers feedback pins (mw/V and A/V) to 0-5v so we dont blow the Arduino. From here the scale is then mathematically converted into a more user friendly value (e.g. 35mw, 6A)
Point 5 is simply a sequence of events handled by relays during each run.
Relay 1 is the fan. This turns on at any time the laser is called into operation. Without it the tube will melt down. This relays simply allows the Arduino to turn on and off the fan when needed (on during run and cooldown, off when the unit is in laser off standby mode)
Relay 2 is the enable relay. This relay only energizes when 3 conditions are met initally, and one is met during run. Initally the Key must be in the on position, the idle/run switch must be in idle, and the E-Stop is open. During run the program monitors the key or E-Stop and kills the laser if the E-Stop closes, or the key opens.
Relay 3 is the Idle/Run relay. When open the laser idles at lowest power. When closed, the laser runs at whatever power is dictated by the voltage divider set at the stepper controlled trimpot, depending on wether its output is connected to the light or current input of the light/current mode relay
Relay 4 is the light/current mode relay. Ion lasers are run in two modes - Light feedback mode, where the tube produces a constant power output, or Current, where the tube is set to a current level, and the light output is what it generates when recieving that current. So if the tube puts out 10mw/A, at 6A the tube will be doing approximately 60 mw.
Point 6 is easy. Its a pot basically, with a stepper motor mentality. Rotate the stepper one way to increase, the other to decrease. By using a high rpm to get close to our target value, and a low rpm to lock on, the stepper could be quite accurate.
In normal run mode, once the start command is called, the controller would do the following:
1. Check all interlocks are closed (E-Stop, Key, Idle/run switch, case)
2. Call the preheat subroutine
3. Start the laser at the lowest power
4. Listen for button presses and adjust the stepper accordingly or stop the laser
5. monitor the feedback loop and math and display the output on the screen.
6. Call the cool down subroutine when shutdown is requested
Maintenance burn mode:
1. Check interlocks
2. Call the preheat subroutine
3. Start the laser at the lowest power. Wait 5 minutes
4. Ramp the power up to half power. Count down to the last 5 minutes of the timer
5. Ramp back down to idle power
6. Call the cooldown subroutine
This simply collects data from the user. This includes Tube maximum allowed current, Head current hours, M/Burn timer default, Voltage divider offset, stepper data. When each value is saved, the Arduino stuffs the result into its corresponding EEPROM address for recovery after a power cycle/reset. If all the blocks used by the program read 255, lock the user into the config screen until the values are filled out. This prevents a laser trying to do a current it was never meant (and nor the power supply is capable of supplying) to do. (e.g. 25A LOL)
This simply allows the user to test all functions of the controller to calibrate it and make sure everything is working before connecting it to their laser.
*phew* thats the menu and tui outline done.
The preheat subroutine simply enables the fan, and closes the enable relay. This provides power to the ion laser tubes filament. The filament has to be allowed to get hot (and the filter capacitors in the PSU to precharge) before firing. This takes about 45 seconds. During this routine the screen will display:
(the # represent a solid block. It advances along the screen until the preheat cycle completes).
Cooldown is the opposite of preheat; it puts the laser into idle mode, runs it here for 5 minutes, shuts off the enable relay (de-energizing the tube and filament) and then runs the fan for an additional 5 minutes. Its screen would look like:
*Idle *Fan 08:44
Danger! Beam ON!
and when the idle mode disengages:
Idle *Fan 3:12
LASER is safe.
Typical run screens:
Light mode in run mode
Normal Mode: Run
Light mode: 35mw
<--------+---------> <--- this is a power meter
Light mode in idle:
Normal Mode: Idle
Light mode: 4mw
Normal Run Screen (current mode)
Normal Mode: Run
Current Mode: 9.7A
Power out: 109mW
Settings Screen (tube current used as example)
Settings: Max Tube I
Use < and > to adjust
Max current: 9.3A
> Tube Max I <
Maintenance Burn Screen:
Maintenance Mode: 15:29
Power Out: 45mw
Press stop to cancel.
Main Menu Screen
Press <> to Select
Start to choose
>Normal Run <
An error Screen:
Turn Key to resume
What I am looking for assistance with:
1. An easily edited menu system for a 4x20 screen
2. ways of looking for button presses without halting the program
3. A little help with math (I dont expect you to do the math, but to help me work out how to make the Arduino interpret a value on its analogue pin to a real reference e.g. seeing 123 on the analoge pin as 10mw, would tell me that 236 on that same pin would indicate 20mw of power.)
Funny thing is, I dont even have the laser yet.
Outputs from laser PSU:
Measure mw, on two pins you get 1V per 10mw (e.g. 15V=150mw)
Measure Current, on two pins you get 2V per A (e.g. 3V=6A)
Insights, thoughts and comments welcome