For contact info, please see the Sci.Electronics.Repair FAQ Email Links Page.
Copyright © 1994-2016
Reproduction of this document in whole or in part is permitted if both of the
following conditions are satisfied:
1. This notice is included in its entirety at the beginning.
All Rights Reserved
2. There is no charge except to cover the costs of copying.
DISCLAIMER
µSFPI1 is not currently intended to replace a stand-along SFPI
controller with oscilloscope display. That may come in the future.
Acknowledgement
Thanks to Jan Beck for getting me interested
in microcomputer development. If anyone had told me
six months ago that I'd be writing code for an Arduino-compatible
board - and enjoying it (sort of) - I would have suggested
they were certifiably nuts. ;-)
Links to his Web information may be found under
References.
µSFPI1 replaces the normal ramp driver and oscilloscope with a compact Arduino-based system with OLED display. A home-built SFPI head could be constructed that is the size of a small pill bottle, so the entire setup could be fit in a pocket - really). :)
The system described below provides most of the functions using the Atmega 328 Nano 3.0 PCB and a hand-full of discrete parts but has limited flexibility in terms of scan rate, offset, and magnification. As in none except for a one turn trim-pot for input sensitivity. :) The default settings would be acceptable for a laser with an output power of 1 mW or more to display its longitudinal modes in real time. Some minimal controls may be added, though nothing fancy. But a version using the previously implemented ramp driver and photodiode preamp PCB described in the section:
While this won't replace a $5,000 instrument, it is more than adequate as-is for determining the basic health of a laser such as whether it is Single Longitudinal Mode (SLM). The display above shows the actual scan of the lognitudinal modes o a 5 mW red HeNe laser.
µSFPI1 consists of 3 parts:
The Arduino-compatible Atmega 328 Nano 3.0 for µSFPI1 provides the functions of both the ramp driver with an external high voltage transistor powered by a DC-DC boost converter if needed, and Digital Storage Oscilloscope (DSO) using a small OLED graphics display. It should work with home-built SFPI heads using PZT beeper elements as well as commercial ones like the SA-200 and others from Thorlabs. For these, a 5 V ramp may be sufficient eliminating the need for the boost converter and its components.
The current implementation runs at about 25 scans per second using the 64x128 pixel OLED. Since the display works like a DSO, this is way more than adequate since there is no flicker. Thus, even when scaled up to a large display in the future, the refresh rate should be acceptable. And of course, the $2 Nano is not exactly a stellar performer, so a higher performance microprocessor could be substituted if needed.
A complete pocket-size SFPI based on µSFPI1 could be built into a 1x2x4 inch case. :-)
This document provides a general descriptions of the the µSFPI1 hardware and firmware.
Most of the half dozen connections on the breadboard are made with the electronic parts themselves or bits of excess wire cut from their leads. But there will be a need for a few insulated jumpers which should use #22-#24 solid hookup wire stripped to fit in the holes.
Arduino Pin Physical Pin Function -------------------------------------------------------------------------- D3 6 Free Run input - Ignore trigger D5 8 Ramp On - High during scan D6 9 Ramp Drive - PWM of scan ramp D13 16 Ramp On (same as D5, Atmega "L") A0 20 P-Mode input (0 to 5V) A1 21 S-Mode input (0 to 5V) A2 22 Trigger input - external triggering only +5V 27 +5 VDC from on-board regulator or USB VIN 30 Optional DC input (+7 to +20 VDC) GND 4,29 Ground/Common
CAUTION: The Nano 3.0 can take +12 VDC on VIN since it has an on-board 5 V regulator. But apparently there can be problems when connecting to USB as I found out. Inadvertent ground loops (or something) can result in erasing its brain or damaging the USB chip. Exactly why this occurred is still not clear. The NANO was connected to USB and then the 12 V adapter was plugged in, at which point the USB dropped out, never to be heard from again with this board. The regulated wall adapter was on the same circuit and isolated in any case, so it should not have caused problems. The Atmega microprocessor is still running something so it's not totally dead, thus the suspicion that the problem is the USB chip. But I've been unable to change it so far, even with a programmer. Therefore, it is recommended that only the USB on a PC or laptop, a USB wall adapter, USB backup battery, or 5 V power supply be used.
There are many ways of doing this - some which may be overly complex, but what I've done for the Atmega 328 Nano 3.0 board is to go to Arduino Software and install the current version of the Arduino IDE (V1.6.9 as of May 2016). (I'm not sure if the board needs to be plugged in to a USB port during this process, but mine was. During the install process, it will ask to install the drivers. Reply "Yes" to all its requests. When the Arduino IDE is started for the first time, go to "Tools", "Board", and select "Arduino Nano". If the Nano is plugged in, its COM port should appear under "Tools", "Port".
More info on software, drivers, and more at Getting Started with Arduino and Genuino on Windows.
The more complex installations may be required if you bought the Nano from eBay or off the back of a truck, depending on whether it has the genuine FTDI USB communications chip. And even more complex if it doesn't have the bootloader installed. Links for driver installation may be found under References under "Arduino". Instructions for burning the bootloader may be found in the section: Burning Bootloaders into the Nano or Pro Micro.
The Arduino IDE can be used for compiling and uploading, though I prefer UECIDE, below, because compilation and uploading is much faster. For use with the Atmega328 Nano 3.0, either is fine. However the ATtiny and Pro Micro may only be supported by the Arduino IDE. (The latter may come up as Arduino Leonardo though.)
The UECIDE files should be unzipped to any convenient location on your computer. UECIDE requires around 160 MB there, and another 600+ MB for support files typically somewhere like c:\users\YourUserID\AppData\Local\UECIDE. This location can be changed in File->Preferences. If doing this after having configured UECIDE, copy all the files to the desired destination first, then change the data directory in File->Preferences. DO NOT delete the original UECIDE directory or the preferences file! :) Otherwise, the configuration information will all be lost.
Compared to most applications, UECIDE takes forever to start up even on a fast PC. So be patient. That's the bad news. The good news is that compiling and uploading takes literally only a few seconds, much faster than with the Arduino IDE or MPIDE (another one you don't need to know about). Go figure. :)
The first thing UECIDE will likely do is to tell you that no boards are installed and then open the Plugin Manager. If it does not, do it manually by going to Tools->Plugin Manager. At first the pane along the left will only show the word "Plugins". But after a couple minutes, it should update with a list: Plugins, Libraries, Boards, Cores, Compilers, System. The following are required:
For each of these click on "Install". Installing the arduino board will probably automagically install the other related files and may take several minutes. Confirm that each entry has a green check mark next to it.
Close the Plugin Manager and go to "Hardware" or check the status line at the bottom of the window to confirm that the proper Board (Arduino Nano w/ Atmega 328), core (Arduino 1.6.x)), and Compiler (GCC 4.8.1 for AVR) has been selected. Correct it if not.
Some other quirks of UECIDE that I've found:
Plug the Atmega board into any available USB port. The power LED should come on. If I (Sam) sent you the Atmega board, it will have been loaded with a version of the µSFPI1 firmware and the user LED will be flashing at about 5 Hz rate to let you know it is alive. But by the time you've received it, the firmware will probably be out of date, so reloading will be required in any case. :)
Assuming the driver has already been installed, go to Hardware->Serial Terminal and select its COM port. Typically, this will be the highest number COM port, or perhaps the only one, since no one uses real COM ports for much of anything anymore.
UECIDE should remember the configuration settings automatically upon exiting. These are tied to each instance of the UECIDE window, so it's possible to easily deal with multiple totally different board types.
Compiling... * Compiling sketch... * Compiling core... > arduino * Compiling libraries... * Linking sketch... Compiling done. Memory usage * Program size: 7532 bytes * Memory size: 1092 bytes * Compilation took 8.634 seconds Uploading firmware... * Resetting board... * Uploading... * Resetting board... * Upload Complete
Once the firmware has started, the on-board LED "L" should be flashing at around a 25 Hz rate to let you know it's alive.
The firmware is retained in non-volatile memory so uploading only needs to be done once - or until a new version is available!
The firmware may also be compiled without uploading by using Ctrl-R. Since you haven't messed with the code, it should compile without errors. This is slightly faster for testing and doesn't use the board at all so it can be off doing whatever it pleases. :)
#define RESET 10.
// #define USE_OLD_STYLE_WIRING(remove the "/ /") so that MOSI, MISO, and SDK of the target Pro Micro will be defined as pins 11, 12, and 13 on the Nano.
Follow the instructions in the following sections as appropriate:
If this step completes without errors, it probably worked. ;-) If there are errors, double check the wiring and board/processor selections. Confirm that the bootloader was burnt successfully by unplugging the ISP Nano from the USB port, disconnecting the VCC and RST lines (at a minimum) between the two boards, and plugging the target Nano into a USB port. For a Far East clone, it should now come up something along the lines of "USB Serial CH340" with an associated COM Port - and voila! no errors. :) For a geniune Nano, it may say something about FTDI but should come up without errors.
Change the Programmer back to "ArduinoISP" for normal use and select the Nano's COM port.
Then upload the blink sketch or anything else that will provide a definitive indication of success.
If this step completes without errors, it probably worked. ;-) If there are errors, double check the wiring and board/processor selections. Forgetting to select 5V, 16 MHz processor will result in an error. (The default is 3.3V, 8 MHz.) Confirm that the bootloader was burnt successfully by unplugging the Nano from the USB port, disconnecting the VCC and RST lines (at a minimum) between the two boards, and plugging the Pro Micro into a USB port. It should now come up as "USB Serial Device" with an associated COM Port - and voila! no errors. :)
Change the Programmer back to "ArduinoISP" for normal use and select the Pro Micro's COM port.
Then upload a sketch that will provide a definitive indication of success. (The normal Blink sketch will not work on the Pro Micro without modification since there is no LED on Pin 13.)
build.path=C:\TEMP(Replace TEMP with the name you chose if not the same.)
Now the error should not appear, hopefully, maybe. ;-) This worked for me on 3 PCs. Don't try to explain it, if it works, use it. :)