In my prior blog (Continuing to organize - soldering and storage improvements.... ), I had started to revive an older project with a few new features. I had originally built my light ring for my microscope (Nikon SMZ-2) back in 2012. This setup has been in almost constant use for the last 9 years. About 3 years ago, I had this idea to add a laser marking system to the light ring, so that I could simplify positioning my current work directly in the center of the microscopes field of view. I had printed a simple laser mount that could attach to the existing light ring to try out the concept. While everything worked, I wanted to tie the laser control into the existing light ring controller. The original light ring controller was based on an ATtiny45, in a 8-pin package. Unfortunately, all the pins on this device were full utilized. That and the fact that I had used a complex, and long since lost series of cables to reprogram this device, I abandoned this project.
My renewed interest in the project, kicked off by my desire to get a little bit more organized, caused me to revive this design. The first thing that I would do, would be a complete update on the light ring controller. So lets start by reviewing the existing design. Here is the original schematic and layout (PCB is 1.0" x 1.05"):
The ATtiny45 pins are assigned to following functions:
Pin Number | Assignment |
---|---|
1 | Reset - used by ISP available to J2-1 (Reset) |
2 | Analog input - used to read which switch (or switches) are currently pressed |
3 | LED1 - Red LED, used to indicate that mode selection is active (also used to set timeout value) |
4 | Ground (also used, through USB connector for ISP - GND) |
5 | SDA - I2C data to the light ring (also used, through USB connector for ISP - MOSI) |
6 | LED2 - Green LED, used to indicate that intensity mode is active (also used to set timeout value and flashes during sleep mode to indicate that the unit is plugged in) (used by ISP - MISO, available to J2-2) |
7 | SCK - I2C clock to light ring (also used, through USB connector for ISP - SCK) |
8 | VCC - +5 Volts (also used, through USB connector for ISP - GND) |
Due to the shortage of pins on the ATtiny45 processor, I used a single analog pin to read a combination of switch presses from a weighted voltage divider (no multiple switch combinations were actually used). Also, as mentioned above, I rigged up a semi-remote ISP connection (no space for the 2x3 header on the tiny controller board), that had the controller board plug into a blank Light Ring board (with an ISP connector) and run 4 lines of the ISP connection through the USB connector and another two wires (flying leads) for the remaining connections.
Switch presses - The four switches are assigned as follows:
- Switch 1 - Mode select. A normal press and release of this switch enters the Mode select process. While in Mode Select, the UP and DOWN buttons toggle through the various modes (All LEDs On, Gradient, 3/4 LEDs On, 1/2 LEDs On, 1/4 LEDs On or a single LED On). A special case for this switch is long press condition, where the controller enters a sleep mode after commanding all of the LEDs to off.
- Switch 2 - Enter. A normal press and release of this switch either enters the 'Rotate mode' (if any mode other than 'All LEDs ON was selected) or otherwise return to the 'Intensity mode'. In 'Rotate mode' the UP and DOWN buttons would rotate the selected pattern through the 12 LEDs. A special case for this switch is long press condition, where the controller enters special mode to set the time duration for the auto sleep mode. In this mode the UP and DOWN buttons toggle through the various sleep mode timeouts (30 mins to 270 mins in 30 min intervals).
- Switch 3 - UP. This switch would either rotate the patterns in one direction or increase the intensity on the selected LEDs.
- Switch 4 - DOWN. This switch would either rotate the patterns in opposite direction or decrease the intensity on the selected LEDs.
The switch positions are decoded using a lookup table that translates the voltage into which switch was pressed. Due to the weighted divider arrangement each combination of switch presses yielded a unique voltage. Here is the spreadsheet of the decode process (the yellow entries represent the only modes that were used, no button - line2 or the single button presses - lines 3, 4, 6 and 10):
The controller board does all of the heavy lifting in this design. It determines the on/off/intensity of each of the 12 LEDs in the light ring and sends out the settings via I2C to the two individual half rings (using two addresses). For each mode or intensity change the controller blasts out the settings. Note: Each LED on the light ring (12 total) are actually made up of three White LED elements, creating a light equivalency of 36 LEDs.
Moving on....
Seeing how there were no available pins to control the lasers, I decided to update the design an create a more flexible and extensible controller. My plan was to keep all the existing functionality, but to add the laser mode and fix a few issues that I had with the functionality. For the Laser mode, my plan was to use the 'Enter' button (while in the normal intensity mode), to turn on the lasers and reduce the Light ring intensity by 50%. The lasers would stay on for 30 seconds, or until the 'Enter' button pressed again. Another change was to modify the auto sleep function. In the prior design, when the sleep timer expired the Light ring would immediately turn off. Several times over the years of using this device, I would be in the middle of a delicate soldering operation and the light would go out (usually followed with me making some sort of exclamation). My plan here is to create a warning period where the light ring would begin to blink (very short off time) to indicate that sleep was approaching (for 30 seconds), allowing me to press a key to keep postpone the sleep cycle.
Looking through my inventory of parts, I decided on using my trusty friend, the ATmega328PB processor to replace the ATtiny45 processor. It took a bit of cramming and creative layout to fit a 32 pin TQFP processor in place of the old 8-pin SOIC part, but I was able to fit it, along with an actual ISP connector. Here is the revised schematic and layout:
The new design includes a ISP connector (J1) a split, through hole connector (J2 and J3) for the USB cable to the light ring, power connector (J4 - also a USB cable) and the new laser connector (J5). The switches are now directly read by normal GPIO inputs. The layout uses the same outline and switch/LED placements. The ISP connector is left unpopulated, but I can easily connect the programming pod when needed to make firmware changes, but still allowing the new board to fit into the existing controller enclosure.
In the process of designing this board, I did make a few errors (these things continue to happen as the old brain is not a sharp as it once was). One mistake was to use the wrong I2C port (wrong in that my compiler has a built-in library for SDA0/SCL0 and I used SDA1/SCL1, so I needed to use a bit-banged method of generating the I2C port). Another mistake was the footprint that I created for J3 used holes that were too small for one of the leads in my USB cable and I ended up only using a few strands on one of the leads (a little too fragile for my liking).
Errors aside, it is up and working. I am currently printing a new laser holder that includes a mounting plate for the controller enclosure. Here are a couple of videos demonstrating the new features:
This is a quick video of the laser marking feature. For this video I shortened the laser On time to 3 seconds to allow the process to be captured. Please excuse the shaking camera effects, I really need to come up with a tripod for my phone. Also the LED intensity does dim during the laser on time, but the phone was in auto exposure and there is just a short flash as the intensity changes.
This is a quick video of the sleep warning feature. Again, please excuse the shaking camera effects.
Thanks for reading along! I will update this blog with some pictures on the final laser/controller mount once I get them installed (still printing and maybe noticeable in the to videos).
Update - 2/27/21
Now this is where I had intended to post some pictures of the complete laser/controller mount, but as is often the case, I have a different purpose for this update. Through out my writing this blog I was kept company by the constant sound of my 3D printer happily going about it's business. At least I continued to believe that it was in fact happy. As I was about 6 hours into a 8 1/2 hour job, I finally took notice that my job was still a few layers above the raft. Even though the head was moving, no filament was being extruded. I am not sure of the order of events, but the filament was jammed. Did the hot end cool too much to melt the filament? Did the filament actually jam entering the heater? After a quick disassembly, I found a distorted filament (partially ground away) in the extruder drive housing. After I reheated and cleared the tip, I extracted the remaining chuck of filament. I then fed new filament into the extruder and attempted to drive it into the heater. Oh no, there was no filament movement (funny but after detecting the failure, I attempted to drive the extruder and thought that I had heard it spinning???). Moving the extruder motor into place on another driver it seemed to work. I am now into a full disassembly to see if I can repair this unit. Only time will tell. I am also thinking about the possibility of buying a new printer to take the place as primary while I refurbish the existing one as a backup (or secondary) printer. I will keep you posted on the situation.
Top Comments