A Microcontroller System

The following is a description of construction of a simple microcontroller circuit that has user I/O, two seven segment LEDs, a buzzer and A/D converter. The user can install new firmware on the microcontroller to program the board to perform a variety of functions; its application as a driver for a commercial CO2 laser is discussed here.

The circuit

This is not a complicated system. The laser driver circuit is primarily organized around an AT9028515 chip. Port D is connected to pull up resistors to receive input from a rotary switch. Port B is primarily performing programming functions, although PB0, PB1 and PB2 are also connectted to pull-ups and tactile switches. Port C is controlling seven segment LEDs with intermediate BCD converters. Port A is connected to a two peripherals, a piezo speaker and an A/D converter chip (ADC0831). PA0 is TTL output which will be driving the laser. Various switches control the power which can come from either a power supply or a battery and lead to an LM7805 voltage regulator.


[jpg] [bmp] [dxf] [eps]

I/O configuration . Headers are everywhere on the board which were intended to make its easier to customize the board to have other functions. For example, for a computer to control the laser signal by TTL, the headers connected to the DB-25 can be connected to one of the ports of the microcontroller. The user can reprogram the firmware to respond to the input, and then send a pulse-width modulated (PWM) signal off in the direction of the laser. Similarly, I put headers on the board that basically allow it to act as a motherboard in a larger system. If the user didnt want to have the rotary switch mounted directly to the board, but prefers it be mounted on the panel of an enclosure, this is possible by connecting to the PORT D header.

Circuit design software

This circuit was made using Proteus electronic circuit simulation software. The proteus file is here. Proteus is really really amazing software. It is available here although they may be offering some kind of freeware. I found a Proteus testimonial on the web which gives a good description of its features. Yes, its expensive.

This software is extremely effective but does not produce very good vector files. The chips on the dxf and eps files are solid black, but can be edited with some patience and a drawing program such as Adobe Illustrator.

Various caveats

  • This is not a kit. This page is public mostly because I know if I would have found it useful when I was designing this circuit.

  • The printed circuit board (PCB) is not available. You may make your own, using the gerber files. It cost me around $100 from PCBfabexpress. Expect the cost of parts to be around $60, and you'll need something to program the AVR microcontroller. Another alternative is to get a generic AVR development board like this one from Baritek. Most of the functions that can be found on this system could be handle by a board like Baritek's.

  • There are probably more elegant ways to provide input into a microcontroller. I went with the rotary switch method, which uses a lot of pins on the '8515 because it was easy to model in Proteus. Having that ability made it easier to sit on an airplane and design firmware.

  • The circuit diagram may look a little incomplete. For example, there is a connector labeled PS IN, which is not connected to anything. This is because on the PCB, it isnt connected just yet. This was left unconnected so it can serve as a mounting point for bring power in from a relatively high amperage external power supply. The user can add heavy wires from that point to where they are needed.

    Construction

    Proteus has a circuit board designer called Ares which produced the traces on this circuit board.


    [jpg] [bmp] [dxf] [zipped gerber]

    To make your own PCB, use the gerber files and the PCBfabexpress service. Original cost was around $100.

    Other items that you'll have to obtain are:

    • Parts from Mouser which cost around $60.

    • Two chips, a ADC0831 and the AT90S8515 microcontroller.

    • A programmer for the microcontroller. Examples: 1, 2, 3, 4.

    • And you may want to consider some type of enclosure.

    Bim badda boom.


    [jpg] [mov]

    Did I have to cut any traces? Yes but you wont notice in the new gerber files.

    Reprogramming the firmware

    The most recent copy of the firmware is here. You'll need a programmer for the microcontroller. For examples see: 1, 2, 3. There are also examples of programmer circuits that have been published in abundance on the net. The programmers work in a couple different ways. Some of them program the microcontroller when the micro' is plugged directly into the programmer board. Another mode is to connect a ribbon cable coming from the programmer directly into a connector that is attached to the board holding a microcontroller. This second method is refered to as an "In-System Programmer", or ISP, just in case you encounter that term on the net. The stk500 is very versatile and has a system that works both with a chip plugged into the board, or by ISP programming.

    I bought this programmer from MikroElektronicka because it hangs off of my USB and my favorite development computer doesnt have a parallel port. If you do have a parallel, you can consider a cheaper $19 system that has a 10-pin connector that also will plug right into the ISP header on the laser driver.

    When considering programmers, one issue is to make sure your programmer has a ten pin connector with the following pin configuration:

    Its important to get the 10 pin connector attached properly to the driver board. Pins 1, 5, 6 and 10 are labeled on the board, be sure to hook 'em up right to the connector of the programmer. Note, on the drawing above that pin 2 is unconnected. For what ever reason, my programmer connects to Reset via pin 2, and pin 3 is unconnected. Jumpers were placed on the laser driver board to configure it connect Reset to pin 2 or pin 3. Set the jumper to connect Reset to the proper pin for your system.

    Okay, your programer should come with software that handles moving the firmware over to the device. If you made a homemade programmer, I dont have much experience with them, but there oughta be freeware out there that will work.

    Steps to loading firmware on to the laser driver board.

    • Make sure no power is being supplied to the driver board.
    • Set the jumper to connect Reset to the proper pin.
    • Remove the jumper near the battery.
    • Connect your programmer to your computer.
    • Connect the 10 pin connector from your programmer to the driver.
    • Run the programmer computer software to move over the firmware

    A Laser Driver System

    The board has been generalized to support many different functions and was originally made to support operation of CO2 lasers from at least two commercial vendors. A common need for CO2 lasers is circuitry that will produce a pulse-width modulated square wave to drive the laser continuously. Users also require the ability to test their laser by producing spikes of short duration, as well as performing A/D conversion to read the voltages from a pyrometer.

    Laser Operation

    Most CO2 lasers have their power adjusted using a pulse width modulation (PWM) control. The purpose of the board, and the firmware that is currently loaded into the board, is to drive laser which require PWM signals with varying length duty cycles that ultimately adjusts the power of the laser. Here's a picture of various square waves with different lengthed frequencies and duty cycles.

    One laser that uses PWM signals is a Luxar 25 watt CO2 laser. This diagram is only a sketch but describes a little circuit board that hangs off the Luxar. The only inputs are 28volts, and +/- for TTL logic. I dont know where I got this information but I believe that the power output of the beam is controlled by varying a PWM wave from 0-25khz. (Or you you can just tie the +5v to high and it will run on continuous power which makes the thing overheat.)

    The driver is set up to connect a 28 volt DC power supply into the board, there's a high amperage switch on the board. When the power is switched on it passes it on to the laser, and the input is also used to drive the circuitry on the driver. The connection to the laser also delivers the PWM signal to the laser.

    Another CO2 laser made by Coherent is a Diamond G100. The documentation for the G100 has a description of a test circuit here:

    to support the G100's operation, the driver has a DB25 connector which connects to the G100 and supplies the circuitry described in the above image. Posts are provided on the board to monitor the signals Analog FWD and Analog REFL. In this case, the G100 has an independent power supply and a separate voltage source will have to be supplied ot the driver board. The user can use the 9 volt battery on the board, or configure it to use a separate DC voltage source. The manual for the Coherent G100 states:

    "The two inputs required to operate the laser are the ENABLE and
    MODULATION signals... The ENABLE signal is typically used in safety
    circuits and also provides an very easy channel to enable and disable
    the laser... The second function required to operate the laser is the
    MODULATION signal. This signal will determine the laser 'on' interval
    typically called the pulse width. The time interval between the start
    of an 'on' period is called the pulse period. The pulse width must be
    in the range of 5 s to 999 s. The duty cycle must be limited to less
    than 60%. The duty cycle is the ratio of the pulse width divided by
    the pulse period and then multiplied by 100."
    
    The laser driver circuit has terminals labeled LASER NBL, RETURN, ANLG REFL, and ANLG FOR. These are mounting points where an oscilliscope may be attached to view the operation of the circuit as suggested in the G100 ciagram. I have used the term LASER NBL on the board, when the board is set in pulse mode, this is flipped to a ttl high for a short duration. When the driver is used in 'PWM out' mode LASER NBL will receive a PWM signal with user-defined settings for frequency and duty cycle.

    Using the board: rotary switch settings

    The rotary switch has several settings to get the board to perform the following fucntions.

      1 - PWM out. Send a pulse width modulated signal to the laser via Laser NBL. This setting is for driving the laser continuously. There is no button input.

      2 - Pulse out. Send a single pulse when user presses the Commit switch.

      3 - Pwr test. Recieves input via analog/digital converter. Displays value from 1-99 based on input. No button input

      4 - Freq adj. Frequency adjust of the pulse width modulation signal. This value is increased or decreased based on input from Up/Down buttons. Pressing commit stores the data to memory.

      5 - PWM adj. Duty cycle adjust of the pulse width modulation. This value is increased or decreased based on input from Up/Down buttons. Pressing commit stors the data to memory.

      6 - Pulse adj. This set the pulse duration that is used for setting 2, 'Pulse out'. This value is increased or decreased based on input from Up/Down buttons. Pressing commit stors the data to memory.

    A note about storing data in the AT90S8515. This microcontroller is equipped with an EEPROM. The software in the microcontroller is set up to read and write values into the EEPROM. The code I've written works, but I have had the experience of it occasionally failing. I would guess this is because my code improperly handles powering down of the chip when the voltage goes below 5 volts. Do not be surprized if you have to occasional reset the values for frequency, duty cycle and duration for this reason. A better system would probably be to stored values in a separate, battery backed up memory IC.

    Final comments

  • There is circuitry preventing any problem, but if you're using an external power supply, its a good practice to just take the battery off the board.

  • The code that is provided in the zipped gerber files is not the most up to date. The most recent copy of the firmware will be here.

  • This picture is an example of a generic development board made by Baritek. Boards of this kind are in abundance, this is another example of a development system that even has alphanumeric displays and an LCD with tactile switches and a buzzer; the point is that it was probably not necessary to make a custom board. One advantage to this system is that it was specifically designed for this application and has things like high amperage switches, a db25 connector, a rotary switch and an A/D system. But all of that could be put into an enclosure around a development board.

  • The main reason I made the laser drive was because it was fun.

  • Use of advanced technology does not imply an endorsement of Western industrial civilization.

  • Nilno, Inc. © 2006 NILNO.com