Introduction: Combined ISP and FTDI Tool With Pogo Pins

I've been reading Sapiens by Yuval Harari and one of the things that has been the most fascinating to me, is human beings ability to make their life better by envisioning and creating a tool that doesn't yet exist.

In this instructable I will be showing how to make a new tool for improving your microcontroller projects.

When making embedded microcontroller projects, like a binary wrist watch, you usually optimize for size and minimal components. This means you it's often necessary to not include components only needed for initial set up, but instead just the components needed for continual operation. This means the microcontroller usually gets programmed from another programming circuit.

Soldering and desoldering a programming circuit can be a hassle if you want to continue developing the embedded code, and this is the problem this tool will solve!

Let's get started!

Step 1: User Interface

You can easily program microcontroller in different footprints like the Atmega328P SMD or through hole, ATtiny, or other embedded projects through pogo pins. Not only can you upload a serial program, you can just as easily burn bootloaders to all those chips by just flipping a simple toggle switch.

To program a THT Atmega328P it's as simple as inserting into the female target position. If you want to first burn the bootloader leave the toogle switch in ICSP mode, and move it to FTDI mode when you want to upload a serial program.

It's just as easy to do this with a standalone SMD Atmega328P. Just insert the microcontroller in the female DIP headers along with an SMD adapter, and you're good to go.

I've also included DIP headers for an Attiny as a target, meaning you never again have to look for a separate programmer or programming shield for this form factor.

If you for some reason would like to remove the regular oscillator at 16MHz it's as easy as pulling it from the circuit as it's only inserted in it's own female headers. Now you can use any other frequency oscillator, or even the internal resonator if you so choose!

The two most regular used voltages in microcontroller projects are 5V and 3.3V. Changing between these two voltages are just as easy as flipping a single toggle switch. This will adjust the voltage at both the power delivery pins and the serial pins.

If you want to do a custom power deliver, or no power delivery at all - like in a battery powered circuit, you can flip another switch to siwtch the power input to two male headers. Meaning you can supply the proper voltage for your target, which sometimes is no voltage supplied at all.

Step 2: Parts and Tools

Parts

  • 3 x LM358 SMD
  • 3 x SMD toogle switch
  • 1 x AMS1117 3.3V
  • 1 x CH340G
  • 1 x Atmega328P through hole
  • 2 x 16MHz oscillator
  • 1 x Diode 1N5819 SOD-323
  • 6 x 22 pF 0805 capacitor
  • 4 x 100 nF 0805 capacitor
  • 6 x 10 uF 1206 tantalum capacitor
  • 4 x 10k ohm 0805 resistor
  • 5 x 470 ohm 0805 resistor
  • 3 x LED red 0603
  • 2 x LED green 0603
  • 1 x Female USB mini jack
  • 1 x 8 pin female DIP headers
  • 13 x pogo pins
  • 13 x female to female dupont wires
  • 2 x 28 pin female DIP headers
  • Various male and female headers
  • Custom PCB. The necessary GERBER files are here
    • The project was sponsored by PCBway where you can get your custom PCBs custom produced with high quality

Tools

  • Arduino UNO
  • Soldering iron
  • Solder
  • Liquid solder flux
  • Rubbing alcohol
  • Flush cutters
  • Tweezers

Step 3: Explaining the Circuit

The whole project is based around a serial communications chip, which in my case is the CH340G. When you choose to upload a serial program this chip will communicate directly with the target microcontroller. When you choose to burn a bootloader the serial chip will send a message to the master microcontroller, which then sends the bootloader signals along to the target microcontroller.

To make these actions happen I built the circuit starting with the CH340G along with a barebones Atmega328P and required support components like resistors, capacitors, and the oscillators. I then added a target Atmega328P and connected the serial signals, RX and TX, to both the master IC and the target IC.

With this in place I needed a way to choose between sending the serial signals from the master and target. I did this by adding a toggle switch from between the master reset signal and ground. When this switch is toggled the master IC is put in constant reset mode, which is the same as removing the master IC from the circuit. In other words when the master IC is reset, the serial signals move along from the CH340G to the target IC, uninterrupted.

The signals from the master IC to the target IC were also added for burning the bootloader, according to the good old Arduino as ISP and Arduino Bootloaders article.

I also added four op amp buffers to make some LEDs flash based on the communication signals. The way a buffer circuit works is it always mirrors the input voltage to the output of the op amp. This means you can measure the voltage of a signal and make an LED flash, without drawing any current from the signal being measured/mirrored.

If you were to connect an LED directly to the communication signal without a buffer circuit, the LED would draw current from the signal making it flash as intended. But this would degrade the communication signal so much it would no longer be able to communicate with the target IC.

For some more a more advanced op amp feature I used a comparator, described in the next step.

Further resources on operational amplifiers

Step 4: Operational Amplifier Comparator

According to the CH340G datasheet to switch between 5V and 3.3V programming, the pin V3 must accordingly either be decoupled to ground with a capacitor, or connected directly to 3.3V.

To toggle between these two options based on the target voltage, an op amp comparator is used.

The op amp comparator works by comparing the two input voltages and setting the output signal to either of the power inputs.
When the non-inverting input is higher than the inverting input, the output is set to the positive supply. When the inverting input is higher than the non-inverting input, the output is set to the negative supply.

When the target voltage is set at 5V, the inverting input becomes 4.3V after a drop from a diode. This is still bigger than 3.3V at the non-inverted input, and the negative op amp supply is set to the output. In other words, the V3-pin is decoupled to ground.

However, when the target voltage is set at 3.3V, the inverting input is at 2.6V after the diode. This is less than the 3.3V on the non-inverting input which means the positive op amp supply is set to the output. In other words, V3 is tied to 3.3V.

Step 5: Soldering

Soldering the circuit is made easiest by starting with the low-profile, SMD components like the resistors, LEDs, capacitors, SMD ICs. Moving on I soldered the larger components like the oscillators and female USB jack, before finished with the male and female headers.

The pogo pin adapters are made by breaking off the smaller parts of the PCB. To create some distance when pushing the pins I used a couple offset PCBs stacked on top of each other, before adding the PCB being soldered. Before inserting the pogo pins to the PCB I recommend adding a small piece of paper between the offset PCBs and the offset PCBs. The paper will keep the PCBs from fusing together when soldering the pogo pins. I didn't add this paper on my first try and the PCBs became completely impossible to separate!

Step 6: Setting Up the Master

To make the tool work it needs a permanently installed master Atmega328P which always has the sketch ArduinoISP. This will be used to burn the bootloaders to the different targets. To make this master IC we can use the tool just as it was intended, we just need to borrow a temporary stand in for the master Atmega328P. For this I used an Arduino UNO.

I uploaded the ArduinoISP example sketch to the UNO. Then I removed the UNO Atmega and put it in the master position for the tool. Now I could prepare a blank Atmega328P by inserting it in the target position.

With the toogle switch in ICSP mode I burned the bootloader to the blank IC from the Arduino IDE. After the bootloader had been burned successfully, I flipped the toggle switch to FTDI mode. Now I could once more upload the ArduinoISP example code, just like with the UNO.

When the sketch has finished loading the new master Atmega has just been created!

Now I removed the original UNO Atmega from the tool and put it back in it's place, before moving the newly flashed Atmega from the target position to the master position.

Step 7: Finished

Congratulations you've just upgraded your electronics tool box with an awesome new microcontroller helper!

You now have a combination of helper tools one neat package, making you ready to tackle an incredible varied amount of problems in future microcontroller projects.

I recently made an embedded project with 30 factory assembled PCBs which, amongst other components had an SMD Atmega328P. My task was then to both burn bootloaders and program all of these microcontroller. Without this tool, the task would have taken forever! It was a huge time saver having the ISP and serial programmer combined in one tool, with pogo pins to interface to the target PCB.