• And now for something completely different: A little robotics project for the weekend.

    The described robot can be build entirely from model making supplies and materials from the hardware store.
    Also only very few tools are needed. A metal saw, a drill press, a vice and optionally a tap will suffice.

    From the model making store you need:

    • 3 Servos  with M3 thread in the axis  (e.g. HX12K)
    • 12 ball joints with M3 threads and 3mm holes in the sphere (e.g.  Kavan Maxi Ball links 1405)
    • about 4grams of Polycaprolactone (Sold under names like ShapeLock or Friendly Plastic)

    Form the hardware store you need:

    • 850mm of M3 threaded rod (sometimes also available for model making)
    • 27 M3 screw nuts
    • 3 M3 screws 5mm long
    • 3 M3 screws 15mm long
    • 400 mm of 10mm square hollow aluminum profile (1mm wall thickness)
    • 150×150mm metal oder wooden plate for mounting

    (To control the robot you need a microcontroller of your choice.)

    The first step is to divide the aluminium profile in three pieces of 100mm length and three pieces of 30mm length.
    Then 4 holes are drilled and tapped in each of the pieces according to the following drawings.

    Drawing of 100mm lever

    Drawing of 100mm lever

    Drawing of End Effector Part

    Drawing of End Effector Part

    Next the threaded rod is divided into six pieces of 100mm length an six pieces of 40mm length.

    The 40mm pieces are screwed in the aluminium profile, centered and secured with one M3 nut on both sides.
    Two ball joints are screwed on each 100mm pieces of threaded rod and aligned.

    The 100mm aluminum profiles are then screwed to the servoaxis with the short M3 screws. All servos should be in the same extreme position.

    Now the servos can be fixed to the groundplate. I used hot glue but you can use screws as well. The exact alignment of the servos is important.
    To get it right without much measuring I printed out the drawing of the baseplate.  Then the shape of the servos was cut out and the paper taped to the groundplate. The servos were placed at the right position and glued there.

    When the glue has hardened you can attach the ball joints to the servo levers and secure them with one nut on every side.

    Ball Joints attached to lever

    Ball Joints attached to lever

    To make the end effector you need to get the Polycaprolactam into its malleable state.

    End Effector center piece

    End Effector center piece

    Therefore it is placed in a small cup with some water and heated in the microwave or on the stove until it gets transparent.
    Then carefully pour the hot water away and get the plastic out. It should be touchable without burning your skin.
    Now shape it into a three-edged star (see image) and slide a 30mm aluminium profile over each end.
    Try to fill the profile as tight as possible and about 5mm behind the holes.

    Before the plastic has cooled down completely align the three profiles in 120 degree angles.
    When it has cooled down you can drill through the holes in the profile, put the three long M3 screws in and secure them with nuts.

    Now place the ball joints on the threaded rod pieces of the end effector and secure them, too.

    The completed end effector

    The completed end effector

    The mechanical part should now be completed.

    Isometric view of the delta robot

    Isometric view of the delta robot

    Next step is to control the servos with a microcontroller. Servos need a PWM signal with a period of 20ms and a high time from 1ms to 2ms,  depending on desired position.
    This can easily be generated with timers, which are available in almost every µC. To control multiple servos with only two timers and without using to much processing power a clever tactic is needed.

    One timer is used to generate an interrupt every 20ms / number_of_servos. On each of those interrupts one servosignal is switched on and a second timer is started. This timer is set to overflow after 1-2ms according to the desired position of the servo. When the overflow interrupt of the second timer occurs, all servosignals are switched off. This way you do not a variable to save the current servo, because only one servos is active at a time anyway. On the next interrupt of the first timer the process repeats with the next servo. The desired positions can be saved in an array.

    With this method up to 10 servos can be controlled with only two timers and very short interrupt service routines. This way there is much remaining processing power left for other calculations such as receiving and decoding commands via the UART or I²C. Maybe you can even fit the inverse kinematics into the µC.

    Servo Timing diagram

    Servo Timing diagram

    The IK formulas and some explanation can be found here.

    A simple servo controller using the described method can be downloaded here. (AVRStudio project with C-Code).
    A quick and dirty Delphi 5 Project which sends commands to the ATmega and does the IK calculations can be downloaded here. (Contains source and executable).

    And here you can see what you can get:

    Tags: , , , , ,

  • The previous version of the gravitational simulation produced rather abstract results. The lists of coordinates did not say much and the import for 3DsMax was not very handy.

    To overcome this problem I looked into openGL and found it quite easy to integrate.
    The glut-Package for DevC++ includes all necessary files and an example project.

    The whole initzalizing stuff was just copied from the example and the code from the earlier version adapted to produce the coordinates in the corrent form.

    All the objects are stored in a linked list. For each frame the list is traversed and the new coordinates displayed.

    Gravitational Simulation 3D

    Gravitational Simulation 3D

    I also added a linked list to each object that stores all past coordinates. When this list ist used to plot lines between each two adjacent points the trace of the object is displayed. Currently only the trace of 2 selected objects can be displayed at a time. Those two objects also get marked with little triangles and a 3d-crosshair. Their parameters are displayed in the upper left edge of the screen, along with some additional info. To visualize the forces, accelerations and velocities the corresponding vectors can be displayed.

    Velocity- and forcevectors displayed

    Velocity- and forcevectors displayed

    Code can be downloaded here (Executable included).

    Rotating the view is done by holding a mousbutton down and moving the cursor.

    Other commands:
    i    Toggle  Info
    x   Calculate Step
    z   Reset viewcenter to [0,0,0]
    o   Center blue object
    k   Center yellow object
    t   Toggle trace
    p  Select blue object
    L    Select yellow object

    f    Toggle force vectors
    b   Toggle acceleration vectors
    v   Toggle velocity and force vectors

    +-  Increase / decrease step size

    n   Reset world and generate 50 new objects randomly

    */  Increase / decrease gravitational constant

    5 and 0  zoom in and out

    Numblock to move viewcenter

    Tags: , , ,

  • Another update on the CNC.

    The interfaceboards are etched, soldered and tested.

    IO / Control Boards

    IO / Control Boards

    Step- and directionsignals are generated by an ATmega32 which is controlled over RS232.
    This is only for testing purpose. In the final version a PC will control the movement.

    Tags: , , , ,

  • For a long time I had a layout for this circuit, but could never build it, because the layout was to small to be made by tonertransfer.

    So it was the first layout I made with my new exposure unit. It’s quite small, so it fits under the LEDMatrix itself. Therefore only SMD parts are used.

    It took three trys to get it right. The first failed because the etching solution was to weak, took to long and caused heavy underetching. The second was not properly exposed.

    The third try worked perfectly. The alignment of the two layers was good and the etching took only 10 minutes.

    74HCT138

    74HCT138

    MAX6964

    MAX6964

    Soldering the SMD resistors and transistors was not very difficult using a magnifyer and tweezers.
    The 74HCT138 was more or less easy to solder, but the MAX6964 was a bit harder. (The pins have a pitch of only 0.635mm.) But with desoldering braid any superfluous solder can be removed.

    The MAX6964 is controlled via I²C. It has 2 8-bit registers which switch the 16 outputs on and off and 8 8-bit registers which controll the brightness (via PWM).

    To keep the layout easy and the number of vias low, i had to wire the pixels of the LED matrix in somewhat weird way. But this is easily compensated in software.

    The correct order for the rows is saved in a lookup-table (just an array).
    The data for one row is two bytes long. The first byte contains the data for the first four pixels. (Two bits per pixel, for red and green.) The first byte is left to right, the second byte is right to left.

    Most of the code is I²C communication and transforming pixel data to the correct format for the MAX6964.
    Layout and code can be downloaded here. Datasheet for MAX6964 here. (Maxim is very generous when it comes to shipping free samples…)

    Tags: , , , , , ,

  • Manufacturing circuitboards containing SMD-parts with toner-transfer is nearly impossible. The thin traces almost never get transferred completely to the copper.

    One solution to this problem is to use photoresist boards and expose them with UV light.

    The layout is printed onto a transparency, which is then used as a mask for the photoresist.
    I got the best results with inkjet-printed layouts. They seem to be more opaque than laserprinted ones.

    The cheapest UV exposure unit from Reichelt costs 200€. That’s far too much for what is essentially some UV-light source and a glassplate.

    UV Exposure Unit

    UV Exposure Unit

    A much cheaper way to get one, is to build it yourself.
    So i got a broken scanner (the older, the better (bigger housing)) and a face tanner (not broken, but old) from eBay.

    The tanner contained 4 UV tubes, 2 trafos and 4 starters.

    All this was glued into the gutted scanner with hot glue.

    About 90 seconds per layout seem to sufice for good exposure.

    The boards are then developed in a 10% sodiumhydroxide solution and etched in a mixture of hydrochloric acid and hydrogen peroxide. (More information on this etching solution in this great tutorial).

    The remaining photoresist can be removed with isopropanol.

    Tags: , , , ,

  • (FYI : I am currently not posting the projects in chronological order, because I have so much stuff lying around that I did before I had the blog. So those things will show up from time to time.)

    The 4×4 LED Display was my first project with a two-layer circuitboard layout. The alignment was not 100% optimal, but sufficent. I wanted to make the board as small as possible, so the parts had to be stacked at some places. The square LED’s were painted black on the sides to keep the pixels sharp.

    4x4 LED Matrix Circuit Board (Top)

    4x4 LED Matrix Circuit Board (Top)

    The rows and columns are both controlled by a 4094 Shift&Store-register. The upper four bits control the coloumns and the lower four the rows. So for each frame 4 bytes have to be shifted in. That is done via a QBasic programm that toggles pins on the serialport. Instead it would also be possible to just send the bytes over a serialconnection, but I was to lazy to write code for that.
    To generate the patterns, one can put them together binary by hand. But I choose the easy way again and wrote a Delphi-Program to generate patternfiles, which then would be send to the display by a QBasic programm. (I test all my circuits on old DOS-PCs).

    Here is a video of the display in action. The sequence is preprogrammed…so no actual tetris yet..

    Layout and circuit are here. QBasic sourcecode is too ugly to show. How to shift data into a shiftregister should be easy for everyone who can read the datasheet.

    Tags: , , , , ,

  • I recently obtained a very old mobile phone from a friend. The battery was dead, so I dismantled it and to my surprise found a display with soldered contacts. In other mobile phones the display was connected via a conducting polymerpad, which was extremly difficult to use on selfmade circuitboards.

    Googling the name of the display brought up a site with pinout and a link to the datasheet of the driverchip.

    Using my I²C-Adapter and my I²C-Control program the testing was easy. Just look up the commands in the datasheet, put together a sequence and run it. The display works well and even the illumination is intact.

    Pinout (looking at the back of the display with the black blob to the top right):

    1. VLCD
    2. - LED1
    3. - LED2
    4. SCL
    5. VC (Contrast)
    6. VDD (+5V)
    7. SDA
    8. GND
    9. + LED 1&2 (+5V)
    10. VO

    Connect SDA, SCL, 5V supply and a 10k poti between 5V and GND and the centertap to VC and you are ready to go.

    The adress of the display is 01110100 for writing data.

    After sending the adress you first send a control byte, which determines if the following bytes are commands or characters. Sending 00000000 selects the commands. Then we set the datalength to 8bit, the number of lines to 4 and the voltage generator control to V0=VDD-0.8V by sending 00001110. The display is then switched on by sending 00001111, which also sets the cursor position and blinking. The following byte ( 00000110 ) configures the entrymode of the display to increment the adress after every written character and to freeze the display (and not shift it). Then we only have to specify in which of the four lines we want the following characters to be written. This is done by setting the DDRAM adress to one of the following values: 0×00 (1st line), 0×20 (2nd line), 0×40 (3rd line), 0×60 (4th line).

    Then you send a repeated START condition, the adress again, a controlbyte which tells the display that all following data are characters ( 01000000 ).

    Then you can send arbitrary characters. The character-table is on page 15 in the datasheet, and the commands are on pages 23 and 24.

    Clearing the display is done by sending 00000001 as a command.

    LPH7319 controlled via I²C

    LPH7319 controlled via I²C

    The driverchip is called PCF2116. The datasheet can be found here.

    I will post a complete sequence that clears the display and writes ‘Linex’ (x = 1..4) to the four lines soon.

    For now just a photo of the result:

    Tags: , , , , , ,

  • For quick testing of digital circuits and chips I often use the parallelport because it is easy to program in C and QBasic. But writing a program for every new circuit takes to much time. So I wrote a little program to control the parallelport via a nice GUI.

    Parallelport Control

    Parallelport Control

    When you start the executable, you get the Port-Control-Screen, which is divided into the three registers that contain the pins of the port. The pins can be set individually or a script can be created, which places the bitpatterns on the port automatically. Therefore you must select a port, enter the hex-value of the byte, and click ‘Add’. Delays work the same way. The script can be saved and loaded via the contextmenu of the listbox. You can also write the script with any editor, as long as the same syntax is used.

    The ‘Run’-button runs the script n times, with n being the number in the field next to the button.

    The I²C-Mode is activated with the button of the same name.

    I2C Control

    I2C Control

    Here you have a sequence-listbox, the available actions, the necessesary parameters and a listbox which displays the recieved data. Just select the desired action, enter hex-value of the byte to send or delay (if necessary) and click ‘Add’. The contextmenu of the sequence-listbox provides save and load for the scripts.

    In datasheets for i²c-chips you often only find binary values for the commands to send. So I included a field which converts the binary values to hexadecimal numbers. Instead of entering the binary value you can also select the bits directly. The value is loaded into the datafield by clicking the small ‘<’ button right next to it.

    After clicking ‘Run’ it is first checked, if the bus is ready, that is if SCL and SDA are both high (idle). Then the sequence is processed.

    The pins are hardcoded for my parallel-i²c-adapter, which can be found here. If you have a different interface, you can change the code. Maybe I will in include those options in the next version.

    Delphi6 sourcecode can be found here (executable and inpout32.dll included).

    (I only use the code on a Win98 PC, where the inpout32.dll is sufficient. To use it with Win2K or XP you need something like DirectIO.)

    Tags: , , , ,

  • Some years ago a friend of mine introduced to me a numerical puzzle called Sudoku. For every one who has not already heard of it, i will give a short description: The puzzle consists of a square field divided into 9 rows and 9 columns. Furthermore the 9×9 block is divided into nine 3×3 blocks. In every of the nine rows, nine columns and 3×3 blocks the numbers from 1 to 9 have to be positioned, so that every number occurs only once in every row, column and 3×3 square.

    At the start some, depending on difficulty, cells are already filled in. Then one has to conclude the missing numbers by logic. This can be done by a process of elimination.

    My solver sequentially checks the remaining possibilities for every cell. This is done by checking every cell in the same row, column and 3×3 field for the already filled in numbers. The remaining numbers are the possible for the cell. If there is only one, it is written to the cell. This is the simple version, but also the one that executes quicker.

    The more complex version compares the possible solutions for one cell with all the cells in the same row, column and 3×3 field. This allows to assign an number to a field, even if there are more than one possibilities, if one of them only is true for this cell.

    Some times the solution for one cell is ambigous. Then the solver chooses one of the remaining possibilities and then continues with the solution process. If the field can not be solved (when contradictions occur), the next possibility is checked until the field can be solved.

    The code may be a bit over complicated at some points because the strategy developed over time and was not planned in advance. Besides that, all (of the very few) comments are in german, as are all loging-outputs.

    Delphi 5 sourcecode can be downloaded here.

    Tags: , ,

  • Programming 11.12.2008 2 Comments

    I completely recoded the Image Manipulation program. It is now better structured and easier to use. Additionally I implemented the Canny Edge Detector Algorithm and some more filters. 8-bit BMP’s are still not supported, so that would be the next step.

    Binary edge image output from canny algorithm

    Binary edge image output from canny algorithm

    To test the edge detector, I used the image from the Wikipedia article on the topic, as the desired result was known for that image.

    Complete C++ code can be downloaded here (executable included).

    Executing the program without parameters displays the help.

    To perform edge detection on an image, use the following parameter sequence:

    image <input.bmp> <output.bmp> -g -f 0.8 -e -n 80 -w 80 50

    This command first converts the image to greyscale (-g), then applys gaussian blur with a standard deviation of 0.8 (-f 0.8). After that, Sobel filters for X and Y direction are convoluted with the image, which gives an edge image. Those edges are now thinned by Non-Maximum-Suppression (-n 80),  which only leaves one-pixel wide edges, which are above the given threshold. Finally the edge tracer (-w 80 50) deletes pixels not belonging to an edge, by appling hysteresis thresholding.

    Tags: , , , , , , , ,