• USB Display with different Brightness per Digit

    USB Display with different Brightness per Digit

    Last month I finally came around to order a lot of circuit boards that piled up over the last years. One of those boards was made to use some parts I just bought because they were on sale (the 16-segment LED digits) and a sample part I ordered just because I though it would be neat to have (the MAX6955).

    The MAX6955 from Maxim Integrated is an LED display driver for a combination of 7, 14 or 16-segment digits with up to 128 LEDs. The chip provides a font,  global or per-digit brightness control and two-speed blinking between two text buffers. Additionally, 32 switches in a matrix configuration can be scanned and debounced. To talk to the chip, the I²C-protocol is used.

    USB Display Software

    USB Display Software

    To control the display driver, an ATmega168 with the V-USB software USB stack is used. It is supplied with 3.3V and clocked at 12MHz (which is not possible, according to the datasheet, but works fine). Only four buttons were attached to the MAX6955 and placed on the backside of the PCB.

    At the moment, the PC-side software (which uses libUSB-win32) can send text and commands to the AVR which just passes them on to the MAX6955. In the future, I want to add a text memory on the AVR  so it can display and scroll messages independently from the PC. Maybe I will add some functions to dynamically vary the brightness of the digits to produce some cool effects.

    USB Display Backside

    USB Display PCB Backside

    I wanted the circuit board to be as small as possible, meaning it has the size of the eight 16-segment digits. All components were fitted between the pins of the display digits. To program the AVR, a card-edge ISP connector was used. To protect the circuit and to improve the contrast of the red LEDs a case was lasercut from red plexiglas.

    USB Display

    USB Display with Text

    You can download the circuit board layout (Eagle) here, the AVR firmware (C) here, and the software (Delphi) here.

    Tags: , , , , ,

  • Chemistry 17.05.2013 No Comments

    Another little chemistry project: Photographic prints using the cyanotype and salted paper process.

    Cyanotype

    Cyanotype Print

    Cyanotype Print

    The cyanotype process (or blueprint) is used to produce blue contact prints from transparent negatives. The blue color is the water insoluble pigment Iron(II,III) hexacyanoferrate(II,III) which is normally produced by reacting an Iron(II) salt with a ferricyanide salt or a Iron(III) salt with a ferrocyanide.

    To make photographic prints, the reaction has to be catalyzed by light. This is done by utilizing a light sensitive compound which releases Iron(III)-Ions upon exposure. The original cyanotype process uses an Ammonium iron(III) citrate solution, which has several disadvantages. An improved process[1] replaces the citrate with Ammonium Iron(III) Oxalate, which can be produced from simple chemicals in a two step synthesis.

    Synthesis of Ammonium Iron(III) Oxalate

    In the first step oxalic acid reacts with ammonia to form ammonium oxalate:

    Ammoniumoxalatsynthese

    Oxalic acid has a molar weight of 90.04 g/mol but is a dihydrate (two water molecules attached to each acid molecule) which results in a molar weight of 126,10 g/mol. Ammonia has a molar mass of 17,03 g/mol and was available as a 25% (13.4 Mol/L) solution which has a density of 0.91 g/mL. Those numbers allow to convert the molar ration of 1:2 to a weight ratio of 1 g : 1.35 g. I used 1.77 g of oxalic acid and 2.3 g ammonia solution. To react, the oxalic acid is added to the ammonia solution. The resulting solution is evaporated and the remaining solid ammonia oxalate monohydrate is collected. Ideally, it should weigh 2.00 g (14.04 mmol).

    The next step converts the Ammonium Oxalate to Ammonium Iron(III) Oxalate with the help of Iron(III) Chloride. As both reactants are solids, solutions have to be prepared.

    Ammoniumoxalatoferratsynthese

    Ferric chloride has a solubility of 920 g/L, while of the oxalate only 45 g will dissolve in 1 L of water. Having produced 14.04 mmol of the oxalate, we need to add 4.68 mmol of the chloride. When weighing the substances, the fact that Fe3Cl is a hexahydrate, has to be kept in mind. The molar mass of 162.21 g/mol has to be corrected to incorporate the mass of six water molecules, resulting in mass of 1.26 g. The 2.00 g of oxalate and 1.26 g of chloride are dissolved in 44.34 mL H2O and 1.37 mL H2O respectively.

    Vial of Ammonium Iron(III) Oxalate

    Vial of Ammonium Iron(III) Oxalate

    The solution, which should be of a light green color, now contains 2.00g or 4.68 mmol of Ammonium Iron(III) Oxalate and 14.04 mmol of Ammonium Chloride. Unfortunately, I could not come up or find a reaction to separate the two components. But I later verified, that the Ammonium Chloride has no negative effect on the print process.

    Preparing the Sensitizing Solution

    The sensitizing solution is later applied to a piece of paper to make it sensitive to light. It contains three parts Ammonium Iron(III) Oxalate and one part Potassium hexacyanidoferrate(II) by mass.

    The previously prepared 2.00 g of oxalate are added to 2 mL of water, heated to approx. 50°C and stirred until dissolved. In a second container, 0.67 g of Potassium hexacyanidoferrate(II) are added to 1.2 mL of water, heated to 70°C and stirred until dissolved.

    Subsequently, the two solutions are mixed together while continuously stirred. The solution is then filtered, filled up with water to a volume of 12 mL and, after it has cooled, stored in a dark place.

    Preparing the Paper and Making the Print

    The sensitizing solution should be stored in a dark place until needed. It can be applied to paper by placing a few drops on the sheet and dragging them over the surface with a glass rod. This is best done with minimal lighting. When the paper has soaked up the solution evenly, it is hung up to dry.

    The negative can be printed on sheets of overhead transparency. For best results, the image should be black and white and printed with high toner density.

    The dry sensitized paper is attached to the negative and then exposed either by sunlight or by ultraviolet light. I produced good results with UV tubes from a tanning lamp (which I also use to expose circuit boards). The exposure time is about 10s-20s with UV light. With sunlight, you can see that the exposure is finished, when the transparent areas of the negative have sufficiently darkened.

    To finish the print, the paper is rinsed with tap water until all green/yellow color is washed out and a blue and white image remains. After drying the paper, the print can be framed.

    Salt Print

    The salted paper process uses different chemicals and a different method to sensitize the paper. While the cyanotype is based on iron, the salted paper uses silver in the form of silver chloride. This salt is sensitive to light and decomposes to black elemental silver upon exposure. This results in a brown and white image.

    Preparing the Paper

    As the name implies, the paper is treated with a Sodium Chloride solution (2 g NaCl per 100mL water). After the paper has been soaked in the solution, it is dried. Meanwhile, a solution of silver nitrate is prepared (1 g AgNO3 per 10mL water). All steps involving the silver have to be carried out in a dark room to not expose it prematurely.

    The silver nitrate solution is then spread over the salted paper using the same method as with the cyanotype sensitizing solution. When the silver nitrate comes in contact with the sodium chloride in the paper, it reacts to sodium nitrate and the light sensitive silver chloride:

    Silberchloridsynthese

    The exposure follows the same procedure as with the cyanotype. Afterwards, the print has to be fixed to inhibit the further exposure of silver chloride. Due to the very low solubility of silver chloride in water rinsing is not enough.

    Instead, the print has to be soaked in a mixture of sodium thiosulfate, ammonia and water (10:2:100 ratio by weight). The print is soaked in this solution for about 15 min until all the unexposed silver is removed.

    The finished print can then be rinsed, dried and framed.

    Salt Print and Cyanotype

    Salt Print and Cyanotype

    Choosing the Paper

    The right paper plays an important role in making a good looking print. Standard printer paper does not take up the solution very well and wrinkles when drying. I had good results with index cards and water colour paper.


    [1] : The New Cyanotype Process (http://www.mikeware.co.uk/mikeware/New_Cyanotype_Process.html)

    Tags: , , , , , ,

  • Years of disassembling old printers and scanners yielded a lot of stepper motors which lay unused in a drawer for a long time. This was the inspiration to design a small and easy to use interface for a stepper motor. The first idea was to use the standard combination of the L293 motor controller and the L297 full bridge driver, but those chips take up a lot of space and do not provide microstepping functionality. A better option is an integrated stepper motor controller, like the Allegro A3984, which includes a microstep sequencer and the MOSFET bridge in a very small package. It can drive motors with up to 35V and 2.5A, which is enough for most small and medium stepper motors, especially those harvested from printers.

    To provide an easy interface, the motor should be controllable from the PC. This leaves an RS232 or an USB interface to connect to a microcontroller which in turn connects to the stepper motor driver. While there exists a (very good) software USB stack for the AVR microcontrollers, I chose the LPC11U24. After having worked with LPC microcontrollers at my job a lot, I was already familiar with the LPC11C24 and the lpcXpresso IDE.

    The LPC11U24 has an integrated hardware USB interface and a built-in USB bootloader which shows up as an mass storage device to the computer. Flashing a new firmware is as easy as dragging the binary file to the USB driver!

    Additional to controlling the motor via USB I wanted some methods of direct input on the motor. For that reason I added three buttons and a potentiometer on the circuit board. To connect limit or reference switches, some pinheaders are included. Three LEDs provide feedback from the LPC.
    As one motor is seldom enough to do something interesting, a way of connecting several motors together. My solution to this problem was to add a CAN-bus interface using the MCP2515 CAN controller and the MCP2551 CAN transceiver. The MCP2515 is connected to the LPC via SPI. The CAN bus and power connections (5V and motor power) are available on pin headers on each side of the PCB to make the controllers cascadeable.
    The A3984 provides an input for a reference voltage to control the motor current. An 10bit DAC (MCP4716) was added and connected to the LPC via I²C.
    The circuit board was designed to fit on the back of a NEMA17 (42x42mm) stepper motor.

    USB Stepper Motor Driver

    USB Stepper Motor Driver

    As of yet the USB communication is basically working and the motor is turning. The microstepping works quite well and the motor runs very fast and smooth. I have already implemented velocity ramping but apparently still have some calculation errors as the positioning is not exact. Software modules for reading the potentiometer and the buttons are completed, too. Sending and receiving CAN message is also working. The next step is to make the controllers talk to each other and to enable the master to discover other attached motors. After that the USB communcation has to be improved. In the end, the master should store a sequence of motion commands (maybe G-Code?) and control all attached motors.

    As a first test I used the motor to wind a coil for an electromagnet. I wrote a litte delphi program that sends commands via USB and constructed a frame from lasercut plexiglass to hold the bobbin.

    USB Stepper Motor Control Software

    USB Stepper Motor Control Software

    Coil Winding with Stepper Motor

    Coil Winding with Stepper Motor

    When the project is a little more advanced, I will publish the circuit board layout and the full source code for the firmware and the control software.

    Tags: , , , , ,

  • Chemistry 15.05.2013 No Comments

    A few years ago I saw a video about ferrofluid on YouTube. A ferrofluid or magnetic fluid is a stable suspension of magnetite nanoparticles which reacts to magnetic fields in interesting ways. Naturally, I wanted to make some ferrofluid myself.

    There are three easy ways to produce Magnetite (Iron(II,III)-oxide, Fe3O4), at least that I know of. Both are based on the precipitation of an iron salt in an ammonia solution. The first [1] uses Iron(II)-chloride and Iron(III)-chloride as precursors whereas the second[2] uses Iron(II)-sulfate. The third, the one I tried, is explained in this YouTube Video.

    Synthesizing the Precursors

    All three iron precursors are easy to manufacture by dissolving iron wool in hydrochlorid acid and sulfuric acid, respectively.

    Fe+HCl

    Solutions of Iron(III)chloride and Iron(II)chloride

    Solutions of Iron(III)chloride and Iron(II)chloride

    Iron(II)chloride turns to Iron(III)chloride when left in contact with air for some time. The conversion from Iron(II)- to Iron(III)-chloride can be greatly accelerated by adding the oxygen in the form of hydrogenperoxide. The iron wool and the acid is weighed to produce an approximately known concentration of the products.

    Producing the Magnetite

    After the iron has completely dissolved, the solutions are filtered and then then mixed together in a 2:1 ratio of Iron(III)chloride to Iron(II)chloride. This mixtured is then added to a 25% solution of ammonia. The magnetice particles will start to fall out immediately and colour the solution a dark brown or black.

    Preparing the Suspension

    The video instructions said to boil the excess ammonia off and then add oleic acid which should act as a surfactant for the magnetite particles. Unfortunately, this step did not work for me. The particles did not bind to the oleic acid and repeatedly settled on the bottom of the flask when trying to dissolve the resulting black goo in kerosene.

    Perhaps one of the other to methods or using a different surfactant will produce better results in the future.


    [1] : Synthesis and Some Physical Properties of Magnetite(Fe3O4) Nanoparticles (Int. J. Electrochem. Sci.,7 (2012)5734 – 5745)

     

    [2]: Room Temperature Synthesis of Magnetite (Fe3-δO4) Nanoparticles by a Simple Reverse Co-Precipitation Method (IOP Conf. Series: Materials Science and Engineering18(2011) 032020)

     

    Tags: , , , , ,

  • Just a small update on the status of the DIY CPU:

    The circuit design of the main CPU components is completed. The layout was split up in six parts :

    • ALU and Shifter
    • Index Registers
    • General Purpose Registers and Program Counter
    • Flags
    • Clock and External Bus I/O
    • Microcode Sequencer

    Each part occupies an 160x100mm circuit board. The boards are interconnected with pin headers to provide access to the internal data and address bus and to distribute the clock signal.

    DIY CPU PCB Layout

    DIY CPU PCB Layout

    Parallel to the layout the circuit was constructed in a simulation tool to test correct function. To fill the microcode storage with meaningful code, a Delphi program was written to generate the microcode sequences for the opcodes.

    DIY CPU Microcode Generator

    DIY CPU Microcode Generator

    This program was used to implement the microcode for a few basic opcodes which were then used to write a small assembler program that calculates the fifth fibonacci number (see screenshot).

    I’m currently working on some other projects to get some distance from the CPU. This helps to spot errors when looking over it a few weeks later. Then a few additional circuit boards for data I/O and storage/RAM will have to be designed.

    Tags: , , ,