Archive for 'English'

I got me a bunch of 7seg LED boards from sureelectronics and I expected them to have some “smarts” on them even as they are fairly cheap. Now, the nasty buggers come without any documentation so it took me a bit to figure out how they are connected and how to drive them.

The modules take 12V and 3 inputs, data, clock and something called DIMM. After bit of checking out the schematic it looks like this:

DE-DP22811 2.3" Two Digits 7-Segment LED Information Board MTO schematic

DE-DP22811 2.3" Two Digits 7-Segment LED Information Board MTO schematic

So, the data line goes directly into data input of the 74HC164 (it is one from NXP on the boards I have) shift register, clock for some reason goes trough a double NAND and finally the DIMM goes also trough double NAND and then controls the current trough modules. When DIMM line is high the 7segment led will be dimmed (almost off).

For some reason, who ever designed this board decided to go with 74HC164 instead with 74HC595 and to add DIMM instead of latch… donno what to say, I really like latch more then this dimm solution, but it works like this too..

Note that schematic is just something I drawn (at 6am so don’t be too rush on me, I know that according to this schematic dimm low would dimm the segments but it is really not important). What is not on the schematic is “irrelevant” for driving the bastard, the 7seg’s are not connected directly too 12V and to shift register but shift register drives the ULN2003 that then sinks the current for the 7segs, of course there are some current limiting resistors and also a 5V regulator for the onboard electronics. There is also some circuitry (4 transistors plus some extra passive components) that gets the dimm line high dimms the segments but it is too early/late and I really need sleep and is not important really “how” it works… important is “what it does” and how to control it.

Here is also a sample code (for pic16F690 – chosen this one as I had it on the table from some manual I made for a friend yesterday) :

#include <16F690.h>
#device adc=8
#case
#use fast_io(C)

#FUSES NOWDT
#FUSES INTRC_IO
#FUSES NOPROTECT
#FUSES NOBROWNOUT
#FUSES NOMCLR
#FUSES NOCPD
#FUSES NOPUT
#FUSES NOIESO
#FUSES NOFCMEN  

#use delay(clock=8000000)

//define data, clock and blank pin
#define DATAPIN PIN_C0
#define CLOCKPIN PIN_C1
#define BLANKPIN PIN_C2

//define clock delay routine. the display comes with
//NXP 74HC164 so minimal pulse width at 5V is 24ns
//a single nop takes much longer at 8MHz clock (500ns)
#define clkdelay() #asm ASIS nop #endasm

//   0
// 5   1
//   6
// 4   2
//   3    7

unsigned int8 digit[10] = {
  0x3F,
  0x06,
  0x5B,
  0x4F,
  0x66,
  0x6D,
  0x7D,
  0x07,
  0x7F,
  0x6F
};

void clean(){
  int8 i;
  output_low(DATAPIN);
  for(i=0;i<100;i++){
    output_high(CLOCKPIN);
    clkdelay();
    output_low(CLOCKPIN);
    clkdelay();
  }
}

void sendDigit(signed int8 d){
  int8 x;

  if (d<0){
    output_high(DATAPIN);
    d = -d;
  }else{
    output_low(DATAPIN);
  }
  if (d > 9) d=0;
  x = digit[d];

  //send DP
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x40){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x20){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x10){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x08){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x04){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x02){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);

  if (x & 0x01){
     output_high(DATAPIN);
  } else {
     output_low(DATAPIN);
  }
  output_high(CLOCKPIN);
  clkdelay();
  output_low(CLOCKPIN);
}

void main()
{
   int16 i;
   int8 a,b,c,d;

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_oscillator(OSC_8MHZ);

   set_tris_c(0);
   clean();   

   while(1){

     //single module
     for (i=0;i<100;i++){
       output_high(BLANKPIN);
       sendDigit(i%10);
       sendDigit(i/10);
       output_low(BLANKPIN);
       delay_ms(100);
     }

     for (i=0;i<10000;i++){
       a = i%10;
       b = (i/10)%10;
       c = (i/100)%10;
       d = (i/1000)%10;
       output_high(BLANKPIN);
       sendDigit(a);
       sendDigit(b);
       sendDigit(c);
       sendDigit(d);
       output_low(BLANKPIN);
       delay_ms(100);
     }
   }
}

I hope you use it well :)

Another interesting thing is the power consumption. The two modules take up to 750mA when powered from 12V. The brightness is great but so is the power consumption. Depending on how many segments are shown (600mA exactly with 12 source and 8584 on display)  the consumption goes down (for e.g. for 1413 on display the usage is 360mA). What I found is that when I power it from 9V the brightness is still great (almost as strong as with 12V) but the power consumption almost drops 50% so the same settings only 9V the power draw when 8584 is on display is 330mA (when 1413 is on display the power usage is 200mA). As you are “dimming” the display while updating it it the current draw drops a bit but so does the brightness. After some testing I believe 9V is perfect psu for this board.

Tags: , ,

Open Source CDC USB Stack for PIC

Community gathered around Dangerous Prototypes site decided that it is time we have a decent USB stack for Microchip PIC micro controllers that has usable open source licence. The USB stack provided by Microchip as part of the MAL is great, works perfectly but has a huge flaw, and that is, it does not allow you to properly use it with open source projects. When you have your open source project that uses MAL you share your project on some public CVS/SVN/BZR/GIT.. repository but you have to remove all MAL files and add a readme to explain to users how to download mal, how to install it, where to put it etc … and it all makes a huge mess and is very unreliable. The worse part is that Microchip from time to time decides to make incompatible changes in the MAL so that your old code don’t work with new version of MAL. Of course Microchip don’t keep archive of old MAL releases so if you find open source project that is not using up to date version of MAL you can only cry as there’s no way you can get the same MAL developer of the project uses….

This brings us to the new open source stack being developed by the Dangerous Prototype community, namely Honken and JTR with help from everyone else. You can follow the progress on the Dangerous Prototype forum.

At the moment USB stack support only CDC, but hopefully soon we will have HID and some other profiles too. The latest version of CDC stack in form of simple echo application is available on the forum. I modified it a bit to work with 18F2550 and hid bootloader (this one is microchip’s) and you can find hid bootloader in my previous post where you can find bot HEX of the bootloader and the source for linux app to use it. The modified project for MPLAB.X that creates simple USB CDC device that echo back what you send it can be downloaded from here.

The example showing 18F2550 enumerate:

Mar 15 06:45:15 luckey kernel: [ 6694.873125] usb 5-2: new full speed USB device using uhci_hcd and address 8
Mar 15 06:45:15 luckey kernel: [ 6695.053649] usb 5-2: New USB device found, idVendor=04d8, idProduct=000a
Mar 15 06:45:15 luckey kernel: [ 6695.053653] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar 15 06:45:15 luckey kernel: [ 6695.053655] usb 5-2: Product: CDC Test
Mar 15 06:45:15 luckey kernel: [ 6695.053657] usb 5-2: Manufacturer: Dangerous Prototypes
Mar 15 06:45:15 luckey kernel: [ 6695.053659] usb 5-2: SerialNumber: 00000001
Mar 15 06:45:15 luckey kernel: [ 6695.055690] cdc_acm 5-2:1.0: This device cannot do calls on its own. It is not a modem.
Mar 15 06:45:15 luckey kernel: [ 6695.055706] cdc_acm 5-2:1.0: ttyACM0: USB ACM device

Tags: , , ,

Microchip Application Libraries include pretty good HID Bootloader made by Microchip developers. It is fairly small and works even on small devices like 18F2550. Microchip also (inside the MAL) provides the application to upload HEX files to the microcontroller using bootloader. This is all nice and all works good, except that if you don’t have windows there is not much you can do with the hid bootloader as there is no linux version.

As I use Linux only (64bit Fedora Linux – currently v10 and v14 are used in my home) I decided to rewrite the bootloader code to work on Linux. I managed to get it working inside few hours. It is just a small shell application that you run passing it single parameter (your hex file), it will erase mcu and upload hex. It uses libusb-1.0 library and the project is using CMAKE (kdevelop4 is used as IDE).

You can download source code (and linux 64bit binary) of desktop application to upload firmware using hid bootloader here

[arhimed@luckey build]$ ./hid_bootloader ../cdc.hex
nasao
Family: PIC18
ERASED
PROGRAMMED
[arhimed@luckey build]$

If you use PIC18F2550 here you can download HEX file with the boot loader firmware. Note that I changed default behaviour of the boot loader so now you enter boot loader if PGC and PGD are connected instead by tying B4 to the Vss. I did this because all my boards have ICSP connector on them so it is easier to add a jumper over PGC/PGD then to waste a B4 pin to boot loader.

Tags: , , ,

If you use Microchip microcontrollers you really have to try out the new MPLAB.X ide Microchip is working on. It is already up to beta5 where all major problems and all major functionalities are fixed.

Major improvements MPLAB.X offers differently from MPLAB v8.x are

  • It is multiplatform so it works on Windows, Linux and OSX
  • It uses modern GUI that works and does not crash (like old ugly mplab 8 does) based on NetBeans (initially made by Sun, now owned by Oracle)
  • Bunch of stuff that comes with NetBeans (code coloring, code expansion, syntax checking, different plugins, multiple projects in project group, versioning …)

Major news in MPLAB.X beta5 compared to MPLAB.X beta4

  • The parsing of the “core” terms works properly now
  • PicKit2 is now supported
  • C18 works now on OSX too

Major problems with MPLAB.X (current beta5 version)

  • It does not work “properly” on 64bit Linux

This is why I’m writing this post. What does “properly” means here. If you have 64bit linux with 64bit java (jdk or jre) MPLAB.X will use this 64bit java and everything will work except MPLAB.X will not be able to see your PicKit2 or PicKit3 (I assume the same problem will be with other programmers but I use PicKit2 and PicKit3). The work around is to compile your own pk2cmd and use it outside of the MPLAB.X ide but it is really ugly solution, not to mention, there is still no open source version of pk3cmd so if you have PicKit3 there is no work around. The only way around this problem is to install 32bit java.

As I do use java a lot and I use it for memory hungry applications too I really need 64bit java to be default on my system (as 32bit java cannot use more then 2G of RAM) so I did following.

  1. Download 32bit java from Oracle
  2. Be sure to get .bin and not .rpm.bin even if you are using rpm based distro!
  3. Execute downloaded bin file in some directory and it will unpack itself
  4. Rename the extracted directory by adding a -32bit suffix to it (for e.g. mv jdk1.6.0_24 jdk1.6.0_24-32bit ) and move the new directory to a place of your choosing (for e.g. mv jdk1.6.0_24-32bit /usr/java/ )

Now create a script that will start the mplab_ide with 32bit java:

#!/bin/sh
JAVA_HOME=/usr/java/jdk1.6.0_24-32bit
PATH=/usr/java/jdk1.6.0_24-32bit/bin:$PATH
/usr/bin/mplab_ide

Start the script and voila, now your MPLAB.X detects your PicKit2 and your PicKit3 properly :)

MPLAB.X HW Tool Selector

MPLAB.X HW Tool Selector

Tags: , , ,

ABS Burning

Acrylonitrile butadiene styrene (ABS) is a material often used as a material for filament for RepRap technology. Sometimes determining type of plastic you have is not easy and comparing how different plastic filaments burn can be of big help. This video show how ABS burns. Note that while burning ABS release black smoke and black ash and oily smell.

Acrylonitrile butadiene styrene (ABS) je vrsta plastike koja se često koristi u reprap 3d printerima. Kako je nekada teško odrediti tip plastike samo gledanjem test gorenja plastike može da bude od velike pomoći. Za poređenje, ovako izgleda kada gori ABS. Obratite pažnju da ABS gori “brzo” da ispusta gadan crni dim i crni pepeo i smrdi na naftu

Tags: , , ,

PLA Burning

Polylactic acid (PLA) is a material often used as a material for filament for RepRap technology. Sometimes determining type of plastic you have is not easy and comparing how different plastic filaments burn can be of big help. This video show how PLA is burning.

Polylactic acid (PLA) je vrsta plastike koja se pravi iz obnovivih izvora i vrlo je korišćena u reprap 3d printerima. Kako je nekada teško odrediti tip plastike samo gledanjem test gorenja plastike može da bude od velike pomoći. Za poređenje, ovako izgleda kada gori PLA.

Tags: , ,

All parts on video are printed with reprap.

  • Wade’s Geared Extruder drive – the gears are lubricated with some SHELL EP(LF)2 grease – it works great but using some silicone grease looks nicer. Body and gears are printed in natural PLA
  • Figurine – woman’s torso – printed hollow – printed in ABS
  • Led Lamp “chandelier” – printed with single wall 0.5mm thick in ABS

Sva tri primerka su otštampana kod mene na reprap 3d printeru:

  • Ovo je deo extrudera koji gura filament u vrući deo extrudera – zupčanici su podmazani sa SHELL EP(LF)2 mašću mada mnogo bolje izgleda kada se koristi mast za podmazivanje na bazi silikona samo ja nemam pojma gde da je kupim u Srbiji – i telo i zupčanici su štampani od PLA materijala
  • Ženska figura – štampano od ABS plastike
  • Abažur za led lampu od ABS-a, štampan kao jednostruki zid debljine 0.5mm

Tags: , , , ,

I’m half trough with modifications on my rapman’s hot end so I decided to share some of the experience with the rest of you.

First – why?

Shorter the transition zone from the solid filament to the molten plastic the better. Better means

  • Higher precision (you can better control the flow)
  • Less stringing (less ooze + better control)
  • Smoother run / consistent flow

Now, the “smoother run” is the major problem you have to solve as it quickly go from “running not-smooth” to “not running at all”. What actually happens if the transition zone is too long is that between liquid top at the one side of the transition zone and hard part on the other side your filament is “soft”. By being soft when you push it in the heat barrel the filament compresses in length but increases in diameter pushing against the wall of the tube it is traveling trough. The “smoothness of the flow” depends solely on

  • How smooth / slippery the tube walls are
  • How much pressure the filament is putting on the wall itself

The first issue we usually solve by using the slipperiest material that can withstand temperatures up to 260C – PTFE (a.k.a TEFLON ). The tube must be properly machined so that inside walls are smooth. Drilling it with a standard drill reduces the slipperiness a great deal so try to get your tube properly machined from day 1. Big problem with PTFE is that at temperatures we run (up to 250C) it gets “soft” and cannot fully hold shape (this really depends on the actual mixture but the harder PTFE you have the less slippery it is) so some reinforcement is required. The smart people in BFB solved this by encasing the PTFE tube inside a PEEK tube, another material that can withstand temperatures we work on but without loosing structural integrity. This combination has proven to work very good and now I see other hot end manufacturers started to use it too. This is actually where we come to our first problem with BFB hot end. The PTFE tube does not look as it is made from quality machined PTFE but looks more like a “next best thing” – extruded silicone tube. It can also withstand high temperatures and is also slippery, only it is not as slippery as PTFE. Replacing this tube by properly machined hard PTFE tube is the first step in improving your hot end. At the moment when I write this post, the only supplier of machined PTFE tube replacements that I know of is László KREKÁCS. His website/blog/webshop are not working yet so just send him email ( order[AT]arcol.hu ) and check details directly, he is very nice person to talk to I can recommend him without hesitations. You can also find a local cnc shop and make your PTFE tube replacement machined locally, and you might want to check with the BFB if they start to sell upgrades to the existing hot end (or new improved version of one) but attm bfb only offer stock hot end.

Very important to the slipperiness problem is that you have no “gaps” in the flow of filament. This is often assumed to be so, but in reality the PTFE/silicone tube touches very hot (250+C) aluminium and it can deform in the joining point because of the heat. If a gap is formed between aluminum and tube the filament will expand into that gap and the force needed to extrude it would become more then 100 times greater then if there was no gap. There are also some other deformations in this point that can have nasty effects, breaking the seal can lead to all sort of nasty problems, like the last one Forrest had.


Hot end after PTFE tube failure

Hot end after PTFE tube failure

PTFE tube failure

PTFE tube failure


Since going “more slippery” then PTFE is hard, the next thing to do is to shorten the transition zone as much as we can. The only thing to do it (other than using other filament) is to

  • prevent heating of the filament except on the very end where we want it to melt
  • dispose of the heat propagated trough filament itself

The first point sounds simple – we don’t heat it anyway, well, it is not that simple, all our PTFE, PEEK etc are linked to the very hot aluminium heated barrel and they are pressed to it strongly so there is a lot of heat transfered from the aluminium nozzle to the PTFE and PEEK tubes. This tubes are also heated by the filament itself (second point) so in order to solve both problems BFB shortened the PEEK tube and continued PTFE reinforcement with aluminium tube. This tube now serves as a heat sink to cool the PTFE tube and by that to also get rid of the heat propagated up the hot end from hot barrel trough PEEK/PTFE tubes and trough filament itself.

Doing some measurements without filament in the chamber stock bfb hot end measures under 40C on both PEEK and aluminium tubes while tip is heated to 240C, but with the filament inside, the aluminium tube reaches up to 70C leading to conclusion that filament in that region is way over 90C so if you are using PLA the filament is already starting to “swell” at the top of hot end and your transition zone is way longer then it should be (the transition zone should never be higher then end of PEEK tube). Adding a fan to blow at the hot end improves cooling of the aluminium tube so helps a lot, but using fan provided by bfb I was only able to drop this temperature by another 10C. Now, this is all while we had “stationary” piece of filament in the hot end, when you start extruding, you are bringing cold new filament in and the heat propagation is slowed down by the speed new filament comes in. This is why, with default / stock bfb hot end when extruder drive rpm is over 30RPM you are able to print properly as with the fan cooling the aluminium tube and the “fresh/cold” filament coming fast you keep the transition zone short. Problem start to exponentially increase as you slow down the exuruder RPM so at 10RPM it is almost impossible to push filament as it is soft all trough the hot end and with 5rpm you can even see filament swelling outside the hot end which completely blocks it (as it gets stuck at entrance to the hot end). Since I need low RPM extrusion to print high precision objects (0.15mm layer height) printing more then 20 minutes is almost impossible with low melting point filaments like PLA. This is why I started to modify one of my hot ends (have bunch of them, different nozzle sizes …).


HotEnd my mods

HotEnd my mods


Let’s start from the tip – first mod I made to my nozzle is to get a blank from bfb and drill with 0.25mm drill. This does not at all sounds as simple as it sounds. I spoke with 5 different cnc shops and with over 20 lathe owners and every single one of them told me that “they cannot help me as drilling 1mm of aluminium with 0.25mm drill is incredibly hard”. I finally did it myself by hands! Moving up, you can see the big “bulk” on my hot end, this is an insulation ring made out of silicone and some baking paper, it allows even poorly powered heater to retain heat at the tip. Above it you can see some copper wire, this wire actually goes around the whole nozzle connecting the steel triangle with aluminium heat barren with 3 hexagonal rods. This wire is then connected to the earthing wire that earths the nozzle preventing buildup of large amounts of static electricity by plastic flowing trough aluminium nozzle. This reduced incidents with electronics to only a firmware problems (no more resets from static electricity). The latest modification is the added heat sink to the aluminium tube. The tube itself has a very low surface so it is not very effective heat sink. As I have some left over thermal adhesive that I purchased to glue heat sinks to my allegro stepper drivers (think pololu) I bended the aluminium heat sink around 10mm steal pipe to form it properly and then I glued it to the aluminum tube. I’d add a same thing to the peek but unfortunately the thermal glue I have don’t adhere to PEEK :(. There is one modification in this region that is not visible on the picture and that is thermal grease I applied between PTFE tube and the aluminium/peek tubes to increase thermal transfer from PTFE tube to get the heat faster out. The next modification I’m thinking about is to make the aluminium tube longer by 1cm and to shorten the PEEK tube by 1cm. On the picture you see original MDF insulation plate and then original plexy insulation plate. I future I want both of these to be cut in aluminium because the original idea of the MDF ring imo is that bfb guys wanted to prevent heat to move up and damage the acrylic mount plate and acrylic x-carriage. Since I already replaced original acrylic mount plate and acrylic x-carriage with aluminium parts having this insulation is actually contra productive as the huge chunks of aluminium (mount plate + x-carriage) are actually a huge heat sinks and puny heater could not keep them hot even if it was heating only them, so changing these insulation pads to aluminium (and coating them with thin film of thermal paste) will additionally improve heat disipation from the top of the hot end further improving the flow by further reducing the transition zone.

Now, as I work with limited tools that I have at my disposal there is a guy who invested a lot of  time (and money) into designing a new hot end from scratch. I noticed he already incorporated many of the things I mentioned in this article and after talking with him I found out that some more improvements (not related to heat but to the flow, should increase quality a lot) that are not that obvious are implemented. I’m going to visit him in few weeks to get some of the prototypes (and of course a final 3.0) and test them myself. But before I gave his new hot end a try, I will continue to improve on the one I already have.

Tags: , , ,
Back to top