Protostack ATmega168A development kit and USBasp programmer arrived

I won an ATmega 168a development kit form DP days ago. The kit is provided by Protostack.

http://dangerousprototypes.com/2011/07/07/protostack-dev-board-and-programmer-winner/

Today, I got the the board, accessories. Not only development board and also a  USBsap programmer.  How amazing support for developer.

Thanks to DP and Protostack. As promised, I will construct a DDS signal generator (+ more optional features).

A through, brief review for kit,

  •  Well designed and good quality PCB
  • Doubled side PCB but for through hole components ( as a developer, I love to solder through hole although SMD parts are  fun for me)
  • Plenty of spaces for prototyping area
  • Two area, controller, power, ISCP, ICD and development area
  • development area is breadboard friendly
  • Boards are stack-able style
  • Can be power with CR2032 battery clip or USB (optional)
  • Well documented

For programmer;

For interested, closed up photo from Protostack.com.

Programmer,

Fixing and Reverse Engineering Cheap Temperature Controlled Soldering Iron

Last year, I bought a temperature controlled soldering iron from local supplier. I bought a hot air rework station soon and I seldom used this iron because new rework station also has a temperature controlled iron. I like the idea of this iron because of its design. It is not like others temp-controlled soldering stations. See the photo.

Here is close up. You can see inside circuitry.

It is just an iron and temp-control circuit is inside it’s handle.  No dedicated controlled station like famous Weller gun. There is a knob at handle to adjust temperature from 100~400 C.  Yes, it is made  in china. The price is very cheap, about 5$ (do you believe it or not). But the quality and performance is quite good.

One day, I used this iron and it was not working. So, I opened fixed it. Fixing is quite simple and I checked the fault within minute.

– Removed the screw and knob first.

– I checked circuit.You can see an IC, components and a Triac. There is no SMD devices or expensive, complex thing. I noticed that there are 4 wires output to heat element tube. Interesting, I first thought there will be no feedback circuit or sensor in such cheap tool. I was wrong. The red-blue pair is a nichrome coil and the white pair is a thermo-couple. It is a closed loop control circuit, unbelievable.

I started to examine the circuit.

The fault was nothing. The soldering joint of heat coil was dry. Soldering directly to a nichrome coil is not a good idea in such circuit. It should be crimped. But this is no room for this and I just do re-soldering the joint with acid paste flux (which can help to solder metal joint like nichrome, tin sheet ect.. Don’t forget to clean the joint after soldering, acid from flux may conduct your circuit lines). Then, the iron worked again.

I started checking the circuit detailed. The IC is simple common Op-Amp, LM358, low power dual operational amplifier. The Triac is MAC97A6, logic level triac. This means that this Triac can be directly switched with logic level, 5V.

The close up,

As usual, I tried to trace the circuit with the help of back light.

This is final circuit.

tempcontrol-soldering-ckt_updated

# Updated 21 July 2015 : Added the value of C and corrected polarity according to Nguyen Ngoc comment, Thanks.

– The principle of circuit operation is simple. The Op-Amps are configured as comparator. The Triac drive directly by Op-Amp2 via C and LED1. The thermo couple is connected to U1, non-inverting input. The preset VR1 is used to adjust the comparator reference voltage. When temperature is lower than preset, the output of U1 will be lowered than U2 non-inverting input, The output of U2 will be high state and switch on Triac to heat up iron. When temperature is reached to set-point and U1 output will changed to high and U2 output will set to low to switch of Triac.

– The C1,ZD1, D2 and R7 are a simple transformeless zener regulator supply.

-Although it is not a linear feedback controlled circuit, it works, at least for this type of iron. Quite a simple and working design. You cannot defeat china 🙂 .

– I haven’t construct this circuit yet. If you want to construct, I cannot grantee it will work. Do it at your own.  If any one have experience on this, pls let me know.

#Updated August, 2015.

“who care”(may be someone 🙂 ) shared this schematic with some useful calibration tips. Thank a lot. If someone has experience in these tips, pls share your experience also.

yeh10Nq

Testing MPLABX and Open Bench Logic Analyzer (part-2)

The previous post is about the installation, developing and programming of logic analyzer testing circuit with MPLABX. Now, it is time to test with my new OBLS. Connect all input test connectors with PIC PORTB pins and also ground. Power up the circuit.

First, I tested the circuit with oscilloscope to sure the code and circuit are working. Good, output signals are generating. I tested all pins of PIC PORTB. As expected, pin-1 output frequency is twice of pin-2, pin-2 also twice of pin-3 and so on.

There are several of client software to use with OBLS.

I don’t want to use .NET and python. Sigrok is not released yet. RCP client is still initial phase but has some distant features such as frequency and distance measurement.  I also prefer cross platform feature. So, I tested SUMP client and OLS client.

The SUMP client has a installer and installation is straight forward. I like the installer from Gadget factory. There is the original client here but I don’t want to mess with RTTX dependency (used for java serial port support).

For some clients, when you plugin analyzer USB cable to PC, point the driver for “mchpcdc.inf” file. Find in the zip package for “driver” folders and select this file.

http://gadgetforge.gadgetfactory.net/gf/download/frsrelease/154/519/OpenBenchLogicSniffer-2.12b-Setup.exe

The next is OLS client. It is just a zip package and unzip it to required place to install.

http://www.lxtreme.nl/ols/ols-0.9.4-full.zip

– To start measurement, start OLS client

– At menu bar, select  Capture–> Device –> Openbench LogicSniffer.

– At menu bar, select Capture–> Begincapture

– Select Serial port , my PC port is COM12. Leave port speed : 112500 and device : Openbench Logicsniffer.

– You may need to set Acquisition tab for more utilization. Most interested option are Sampling rate and recording size.

– For sampling rate, you can set the highest “200MHz” if you don’t to brother. For rule of thumb, the sampling rate should be twice of measuring signal. ie: if you want to measure 9600 kbps UART output, sampling rate should be 20kHz at least.

– For Recording size, you can check “Automatic” if you don”t brother. For rule of thumb, OBLS support, 24K samples for 8 inputs channel. If you use 16 channel inputs, it will reduced to 12K proportionally. For 24 inputs, it is 8K and so on.

– It is a good idea to check “Noise Filter” to prevent transition spike.

– My test don’t need trigger and leave it. OLS also supports single  trigger or complex trigger mode. For more detailed, here is tutorials in DP site.

http://dangerousprototypes.com/docs/Logic_Sniffer_101

http://dangerousprototypes.com/docs/Logic_Sniffer_102

http://dangerousprototypes.com/docs/Logic_Sniffer_103

– Then click “Capture” to start  capturing.

And here the result is. All hardware, softwares and OLS, OBLS are working well.

 

– Both clients work well and the core functions are the same.

– Personally, I prefer OLS client interface more, its interface is cool

– OLS client can be easily created new plugins with just a putting a file. I want to learn more about this function. Can I add new protocol decoding function as simple RC5 or complex LIN? Can some one point me out?

– I have an idea to test 200MHz sampling capability. I will update soon.

Updated :

Testing MPLABX and Open Bench Logic Analyzer (part-1)

I am a long time fan of PIC microcontroller. I used MPLAD IDE since I learned PIC. Now, developers of Microchip prepared a turn point for their IDE and development platform. The MPLABX is a beta stage IDE for past and upcoming microcontroller development. I like the way of AVR (totally free, flexible and open) and seem Microchip also want to turn this way. Some distant features of their partially open source MPLABX ( I mean partially because it is not fully open source,  IDE is open but compiler and libs are still closed 😛 ) are-

  • Used open sourced IDE , NetBean
  • Mostly open source, free software components and plug -ins (Microchip used WinUSB/LibUSB for USB rather than their propitery USB stack)
  • Crossed platform, Support Subversion, CVS, Mercurial, bugzellia and tracker and most opensoure features of NetBean
  • Seem the most useful feature “History”, you can forward/backward your change
  • MPLAB8 and X are don’t brother each. You can install both. There is also a con version tool to change 8 project to X
  • Assembler, compiler are not changed

I got my new Open bench logic analyzer last month from Seedstudio. I am also a fan of DangerousPrototypes. So, I created a project to test both MPLABX and OBLS.

The idea is simple. To create an 8bits signal generator with PIC. The software project is developed by MPLABX and  target hardware is PIC16F628A. I used this PIC because it is cheap and fast (20MHz clock) in low end controllers series.

First I download MPLABX from here. The installer is about 220M. I don’t nee others C30, C32 compiler at the moment. You can download if you want to use them.

 http://ww1.microchip.com/downloads/mplab/X_Beta/installer.html

I choosethe following along with IDE.

  • PIC18C lite
  • Hitech C lite
  • HitechC pro lite

You may need latest Java.

http://www.filehippo.com/download_jre_32/

Installation is straight forward and finished about 15 mins.

After that, installed C18 and HitechC lite version.The are separate installers. You need to download and installed separately.

Then, Hitech C  lites. The installation style of both HitechC lite and pro are the same except you can choosed trial and lite versions in installati

Then, launch MPLABX…

The four panes as usual IDE, project, project , navigator, editor and output. The two bars, menu and editor. There is also error stripe beside editor window.

There is a guide “Getting started with MPLABX” in web site. But this is exampled with high end PIC and C18 compiler. Not with low end PIC and free MPASM assembler.So, I listed my work here.

– Starting a project

Click on the New Project icon on the toolbar, or select File –> New Project from the menu.

– Select Microchip Embedded under Categories and select C/ASM Standalone Project under Projects.
– Click Next.

– Select Device –> Family: All Families  –> Device: PIC16F628A and Next

– You can select header for debug. I don’t need at the moment and skip it by clicking just “Next”

– I want to use PICKit2 and select it. If you have any tools from listed, you can choose. If you dont have any listed device, just choose “Simulator”.

– Select Compiler –> Mpasm, I choosed this I want to write the code in Assembly. If you want to use listed compiler, you can select here.

– Select where do you want to store your project.

– Click Next and project creation is done. There is a project “logictester” in project pane and infos, setting about the project is shown in navigation.

– This is just the beginning. There is no source file in project. I copy the template “16F628ATEMP” from ../MPLABX/MPASM30/templates/code folder to project ../logictester/nbproject  folder.

– Right click “Source” in project windows and select “Add existing Item..” and choose 16F628ATEMP. Click the file name and rename the file as “logictest”. Make sure to choose Store path as: to “Relative”.

– There is a source “logictest” under source “Source Files” in project window. Double click it to open at editor window.

–  Edit the code as follow. I want to develop the code in assembly to get both speed and optimization. The code is quite simple, just an software base 8-bits counter and output to PORTB of PIC. The software counter will increase from zero to 255 (in binary, 00000000~11111111) and loop forever. Each counter value will be output t0 PORTB simultaneously.  Thus, all 8-pins of PORTB generate frequency twice of its’ lower pin. If LSB pin-1 generates 1MHz, most MSB pin-2 will generate 500 KHz and so on.

the rough pseudo code is:

LOOP:

PORTB = 00000000

PORTB = 00000001

PORTB = 00000010

PORTB = 00000011

PORTB = 00000100

….

….

PORTB = 11111110

PORTB = 11111111

GOTO LOOP

logic tester source

– Build the circuit and attached with my DIY PICKit2 clone. The circuit is quite simple, a 16F628A, 20MHz crystal, 2x22pf capacitors and +5V power.

– To build project, Click on the Debug Project toolbar button.  Building the code for debugging, programming the target and running the program should done.

– Oops, an error show device ID is wrong. I manually checked with PICkit2 standalone programmer software that PIC and PICkit2 are connected well and the device is surely chosen 628A. I am no idea about this error. So, I just click “yes”.

– The message show that building is complete.

– When done, click on Pause then End Debug Session.

– Then, I tested by click “Program Target” on main tool bar. This can also make and program to target. Not need to click Build or debug. It also show the same error but click “yes” and shows building successful and loading complete.

–  Some issues are,

  • I noticed about MPLABX, PICkit2 support here http://dangerousprototypes.com/2010/11/02/reactions-mplab-x-ide/
  • The connection  with PicKit2 shows also error in debug tool
  • Although errors are shown, the building  project  is done. There is also a hex file “logictester.X.production.HEX” under ../dist/default/production folder.
  • The programming to target is also done. I rechecked manually with PicKit2 standalone program. The hex file is successfully loaded to PIC.
  • Some facts checking at  “MPLABX Beta Limmitations” page on IDE start page
  • At “Device and Compiler” support table, PICkit2 and ICD2 are listed

  • At “MPLAB X IDE Features Surpotted” table, device debug header for ICD2 and Pickit2 are not listed

  • From the current issues, ICD2 is not supported yet.
i. There is no Debug Header support at this time for ICD2.

– Conclusion

  • Pickit2 is supported  but not fully yet (can program the target although it shows error).
  • ICD2 is not supported yet
  • I don’t know why the device ID error is shown. If any one know about this, please point me out.
  • It is a good IDE. I love to use such IDE and functions.
  • Although IDE is open, Microchip don’t open or free to it’s C compiler. Lite versions are very limited. Hopefully they change the way of AVR one day. If not, they will loose new generation of developer, students, researchers (like me) who they cannot earn much money for development tools. So, the reason which I use this IDE is will be when I need to develop in Assembly not in C.

– My project source codes

PIC 16F828A Logic Tester

– Refrences;

Next post, I will post testing with OBLS. Stay tune.

Open Bench Logic Sniffer Custom Case

I make a case for my brand new Open bench logic sniffer and shared this work log here.

– First, measure one transparent and one black acrylic glass.

– Cutting acrylic is not easy for beginner. I used acrylic scratching/ scoring tool which I bought from local plastic sheet supplier. Scratch the plate with this tool and bend over table edge. Not need to scratch too deeply, only 1/2 of the plate is enough. If you don’t clear what that tool is, see this “Tools for working with acrylics”.

– Then, measured and drilled the holes. The problem is that there is not much hole for screw in logic sniffer board. So, I try to use plastic washer to hold/keep the board. The sketch is as like this (not scaled).

Cut the plastic washer like this (only half deep). Sorry for shaked photo.

Drilled the plates and file the corner with file to get round shape.

Assembled like this.

Side view,

Finally, new custom case for my OBLS.

I also make a test project (logic signal pattern generator) for testing logic analyzer. I will update in the next post. Stay tune.

Open Bench Logic Sniffer Arrived!

Last month, I ordered Open Bench Logic Sniffer from Seeedstudio. I am a regular fan of Seed and DP. I like the way of their development and business model. Although I have constructed DIY LPT Logic Analyzer, I think I should have more proper logic tool. I am a developer from third country and cannot effort for the higher price.

So, I searched for cheap and DIY style logic analyzer at Internet. I found Saleae, USBee, Scanlogic2, Bus Pirate and Open Logic Analyzer (aka) Open Bench Logic Sniffer. When I saw BP and OBLS, I know that is what I find, cheap, reliable and open source. Although I prefer diy option, the SMD parts cannot be bought here (don’t surprise! this is my country). So, I ordered prebuild board and cable.

Just for the record and helpful others who may need cheap LA like me, I listed some comparison from other here.

Although, I also like BP, I need a pure logic analyzer and I choosed OBLS finally. Here what I received.

I never thought I can get such quality and good performance tool with cheap price. This is my first order from Seed. Sure, I will order more from them. I tested this and I am pleased what I paid for and I got.

I also make a cover-case and a test project for my new LA. I will also post it.

Trip to ShenZhen

 

I am a fan of sparkfun web site. After browsing their tour to Shenzhen, I eager to go there really. Luckily, I had a chance to visit there last a few months ago. First, I heard formerly about Akihabara, a land of electronic in japan. Then I heard about Sehnzhen from some electronics hobbyists and consumer electronics suppliers. The haven of electronics for developpers, suppliers and crazy shoppers.

There are the two places you must visit if you are one of these. The first is Hua Qiang Bei, the electronics shopping mall area.This is the place for anything of electronics. There are many malls both side of the street, many consumer electronics products, some are copy, some are original. The choice is up to you. I believed that most of electronics products

The next place SEG, really this place is at the corner of Huaqiangbei. If you are a hobbyist, developer or a have business in electronic, I believed that you will be surprised in this place.This  is a big Electronic plaza especially for components and parts. I cannot take much photo when I was there. For interest, visit the following sites and view their tour experiences.

After walking arround the above SEG tower (where the plaza is existed), I end up buying the following components. No need to introduce, famous Arduino and shields. I looked around the corner of third floor, I noticed that a girl is testing these boards in a shop (really, this shop is where they assemble these boards). I don’t remember the price detailed but I remembered that much cheaper than others which sold on the net.

The next is soldering flux, probe, 3-rd hands, desoldering wick, steppers and some microcontrollers, usb chips, ethernet chips (not in photo).

Last, if I have a chance, I would like to visit there again. For the  first time, I don’t know what are where and I cannot find many thing what I want. Be warn, it is a big place. if you want to visit for the first time, you should learn from above and others experience and take your time (at least one day for rough and three days for detailed, I think) .

 

 

DIY LPT Logic Analyzer with Old Switch Case + Power

While ago, as an electronic hobbyist, I want a logic analyzer. Being a diy fan, I constructed a simple but efficient logic analyzer. I have old PIII laptop and which has one LPT port. So, I searched for simple design and found these.

1) The Fabulous Logic analyzer

This is original design. But I prefer this site’s design.

2) http://www.hansotten.com/index.php?page=logic-analyzer

Hans add some 1K resistors at buffer IC output and 100 ohm at buffer input as series. And 10K resistors at buffer IC input to protect unwanted noises and to keep pins low unusing.

The circuit is very simple and not need to explain. It is just a buffer circuit for LPT port. I used 74LS244 ic. This is my circuit design. I add LED at  each buffer output to visualize data signal.

After testing circuit, I find for a suitable casing. I have some bad Dlink 5 port switches. I notice it’s casing, some LEDs and good wall-watt adapter.

First, I open the case and check a look. Suddenly, I change my mind to replace old circuit. It has good LED and power supply. Again, I am good in salvaging, recycling :P.

Second, checked power supply circuit. As expected, it is 3.3 V supply. No problem, it can be hacked easily to get +5V output.

The power IC is AP34063, universal DC to DC converter IC. From data sheet, I check possible basic circuit. In circuit diagram, variable resistor is used to adjust output voltage.

In circuit, I checked that R27 is connected to pin-5 as data sheet’s design. I am a lazy bone. I remove R27 and connect a 10k variable resistor and adjust until output voltage is reached 5V. Checked that required resistor value is 570ohm (simply series 100+470 ohm). I solder these resistors to circuit. I don’t have SMD parts and used ugly 1/4 watt resistors.

After fixing 5V supply, I removed all active components (IC, main chip, crystal, matching transformers) with a hot air gun to protect unwanted power drain and recycling.

Then, drilled the hole and attached buffer circuit over main board. Soldered, connected all power, input, output and LED. For LED connection, each LED circuit connection on old  board are traced by using multimeter. All LED are connected from removed IC pins. By stretching these pins by multimeter with 1X ohm line, LED pins can be found. I solder LPT cable directly on buffer. I soldered 2 more LEDs, one for power and one for logic channel since the original circuit contains only 7 LEDs.

I want to use old RJ-45 jack as input connector (it is a good 8 pins connector). So, I solder input pins of buffer circuit to RJ-45 connector pins. Some old circuit board connections are required to removed with a utility knife.

Last, I cramp flat 8 pins cable with RJ45 connector and attached with corcodile clicks to used as input cable. One drawback is I can get only 7 channels because have to use one pin for ground connection.

This is final design,

and running in action.

Finally, there is a new logic analyzer in my bench. I even stored it with original box.

Final thought,

  • It can run up to 1MHz sample rate (means 500kHz may be the highest for input frequency range)
  • It requires giveio software to run in windows paltform (for XP). I found this package and nice instruction here http://www.cs.ucr.edu/~eblock/pages/pictools/giveio.html
  • It supports some protocols decoding such as I2C, SPI, UART etc..
  • The timing seem depend on the hardware (PC) you used

Anyway, this analyzer is incredible and useful for me and thanks to developers.

DIY Variable Workbench Power Supply

After constructing ATX based power supply, I try to build a variable power supply. There are also many design around the net. Some are simple, Some are complex. Some factors such as power factor, size are not critical for me.

– I have a big 28V step down transformer in hand. So, I focused on linear design rather than SMPS.

– I also have a small SMPS module with +5, +15, -15 V, 25W rating with 19~35V input which salvaged from old power supp.Like this one, by combinding this, this supply can be used for both fixed and adjustable.

– Long ago, I also constructed a LM317 base linear regulator circuit. But the problem of LM317 is it support only 1.5A max and minimum offset control voltage is 1.25 V. So, it cannot drive high load and cannot set the voltage below 1.25V.

I need a linear regulator with 0~30V adjustable and about 10A load. Find out the web and finally I saw this page by ON6MU.

http://users.belgacom.net/hamradio/schemas/6-20amps_regulatable_powersupplies_on6mu.htm

It support higher current, 0~30V and used LM317. I am inspired his design and try to construct this.

First, I have old bad power supply. This chassis has switches, 7-segments display and fan outlet. As usual, remove bad power module first.

Then, mark and drill, attached all required outlet. I print a sticker to cover original chass front labels. Speaker tap is for adjustable voltage output while other are fixed output. A variable potentiometer is for adjusting output voltage.

Third, power transistor 2N3055 are installed with a heat sink. Be care! this transistor collector (body of TR) should be isolated from heat sink. Several plastic washers and sil sheets are used for this.

If not clear how to install power TR and heat sink, check this image.

Test to ensure no continuity between all collectors and heat sink with the multi-meter before installing in the chassis.

Connect base and emitter in parallel. Connect all collectors with 0.5 ohm (5W) resistors.

Measure, drilled and seated , Installed all components.

Rough connection diagram is as follow.

There is no power out for 12V fan. So, I installed a 7812 regulator to power the fan.

Cabling is finished.

Testing …and finally there is a new variable + fixed power supply in my bench.

For the next step, I am considering to add current control circuit. Still tune.

Credit to : ON6MU

DIY Workbench ATX Power Supply

I love DIY and home-brewing. As an electronics engineer and hobbyist, the first equipment in my workbench is a stable, multi-voltages power supply. Formerly, I used wall-wart or small DIY power supply with mostly 78xx linear regulator. As for now, I think to build a workbench power supply.

There are many DIY workbench power supply designs around the net but I need a simple and stable for the first. Since I inspired by PC power supply base design, I started to build the one. Using power supply as power source is a good idea, no need to brother the design complex and quality plus low budget.

First, I find out good articles for reference.

http://en.wikipedia.org/wiki/ATX

http://www.wikihow.com/Convert-a-Computer-ATX-Power-Supply-to-a-Lab-Power-Supply

http://tgbuilds.wordpress.com/projects/diy-bench-supply/

Second, I find an old ATX PC power supply.

Then, strip apart all.

I find old 12V battery chassis. Good, this one has buildin switches, fuse and taps.

Measure, marking and drill holes for tappings. Install output taps.

Seat ATX power circuit, cut the cables and solder to each outlets.

The wiring diagram is as follows. I used 2 x 4.7 Ohm resistor with small heat sink as dummy load. Without it, the supply cannot be maintained stability.


The connection diagram is as follows. Interesting, my supply is labeled as -5V output (500 mA). I cannot find it in ATX pinouts. It (pin-20, white)  is labeled as reserved in wiki page. After checking, this pin-20 is connected with a 5V zener diode is circuit. It is really a simple zener supply. Anyway, it is a good idea to put -5V pin-out although it is small ampere.

Oop! Don’t forget to connect fan power pins also. If not, your supply will heat it up. Note the original fans supply pins before take off. Usually, its a small red-black pairs cable.


Cover the case. I attached the fan at the right side and drill some holes for ventilation.

I removed label sticker from original ATX case and stick it over new supply. So, I can easily check the rating of each output. More, print out  and stick labels for each taps. Finally, this is it. There is a new workbench power supply in my workbench. It is happily running now.