Monday, 3 April 2017

Capacitors are your friend - but how much of a friend?

On one hand I agree, when dealing with large momentary current draw, capacitors are your friend. This I agree with. However using this phrase without knowing the details of the circuit or limitations is just plain stupid. There comes a point of diminishing returns.

GSM applications are a great example of dealing with large currents for a short period of time. Most GSM modules can pull up to 2A for a very short period of time before dropping back down to a nominal current draw in the milli-Amp range. As the nominal current draw is in the in milli-Amp range, we don't necessarily need a power supply that can supply 2A all the time. This would be expensive and bulky. In this case, capacitors can be charged to store this energy when it is needed. This is a typical application of when the phrase "capacitors are your friend", applies.

It's not quite as simple as adding a bunch of 100uF capacitors and we should be alright. Usually when a large current draw is necessary, we get an inductor effect. The device will try pull this power, if it can't supply this power, it will caus the voltage to drop, to try and meet this current. Once the voltage drops below a certain level, our circuit, microcontrollers and other devices will stop working. We absolutely do not want this to happen.

In order to stop this from happening, we need to know three things:
  1. How much energy is needed
  2. How quickly this current draw is needed
  3. How often it is needed
How much energy is dictated by the voltage, the current and the duration of the current pulse.

How quickly we need it dictates our ESR (equivalent series resistance) of the capacitor. The larger the resistance, the slower it will provide this stored energy. It's also important to note, the lower the resistance, the more expensive the capacitor.

How often is it needed tells us if we have enough time to charge the capacitor(s) before the next current pulse. While expecting the capacitor to discharge with the current pulse, we often forget the capacitor has to charge back up again in time for the next pulse.

We also need to know what our power supply can handle as this dictates our charge time. 

The GSM modules are a great example of a case where capacitors are your friend. The 2A pulse happens only for a very short amount of time (~2ms). Using the following equation:

C = t x I / V

Where C is our capacitance, t is the duration of the spike, I is our current spike and V is the acceptable voltage drop. A greater acceptable voltage drop, will allow for a smaller capacitor. For the current, we're specifically interested in the current above what our power supply can provide. Let's assume a 500mA supply.

t = 0.002 seconds (2ms)
I = 2 Amps - 500mA = 1.5 Amps
V = 0.5 Volt

C = 0.002 x (1.5 / 0.5) = 0.006 Farads = 6mF


In the world of IoT, I'm currently working with Sigfox. While I have no problems with the European (RCZ1) products that need a 50mA pulse, it's the US/AUS/NZ (RCZ2 and RCZ4)  that need a much larger current pulse (250mA) that provide a problem

Taking the European Sigfox, a 3.6V Lithium Thionyl Chloride C Cell battery can provide up to 100mA without problems. The transmission time is a little longer at 6 seconds for 3 transmissions. I'm working with 6 seconds here as there isn't really any time for a capacitor to charge to full again in between each transmission. The following equation assumes the battery can't supply the 50mA. 

t = 6 seconds
I = 0.05 Amps
V = 0.5 Volts

C = 6 x (0.05 / 0.2) = 0.6 Farads 
(this seems large, but the battery can easily handle this, so we don't care)

Now, let's take the same battery for the US/AUS/NZ networks. The current draw is larger than what the battery can supply. The transmission time is shorter, but the current is larger. 

t = 3 seconds
I = 0.250 Amps - 0.1 Amps (supplied from the battery) = 0.15 Amps
V = 0.5 Volts

C = 3 x (0.150 / 0.5) = 0.9 Farads

We can see that we need 0.9 Farads of capacitance to ensure no more than 0.5 Volt drop over 3 seconds with a battery providing 100mA. Compare this to the GSM module, this means a capacitor 150 times larger for the Sigfox solution. I'll admit, this isn't quite what I was expecting from something that advertises itself as a low power wireless evolution. That's even assuming 0.5 volt drop is acceptable, which in most cases, it won't be. 0.2 Volt drop is more acceptable, but this increases the needed capacitance to 2.25 Farads. With an ESR below 1 ohm, this capacitor will be both large and costly to the product. 

While Capacitance is your friend, it is subject to diminishing returns. In GSM applications, capacitance will help you without affecting costs too much. In the case of US/AUS/NZ Sigfox applications, a larger battery with better current handling is necessary alongside some smaller bulk and decoupling capacitance to ensure sufficient power when you need it.



Wednesday, 8 June 2016

EPE: PIC Microcontrollers and the PICkit 3: A beginner's guide – Part 2



This month, is part 2 of an ongoing series going back to basics for PIC Microcontrollers and the PICkit3.

Over the coming months, I'll be covering everything from the difference between microcontrollers and microprocessors to Microchip's MPLAB X IDE, the PIC Low Pin Count Demo Board and the incredibly useful PICkit3 programmer tool. I hope to build a strong foundation of understanding for microcontroller programming and project design.

This month I take a look at Microchip's MPLAB X IDE. This integrated development environment allows us an easy allow in one package that allows us to write and compile our code, manage our projects and libraries, as well as program and debug our PIC microcontrollers from a single visual platform. This is the tool for designing any PIC project.

If you've always to give PICs a try, but didn't know where to start, then I recommend checking out last months article in Everyday Practical Electronics.

You can buy the latest edition in PDF format online at http://www.epemag.com/buy-epe-online.html or you can buy it off from the shelf in your nearest newsagents.

To follow along with the articles, I recommend getting your hands on the following:
1. Purchase the PICkit 3 Low Pin Count Demo Board (http://tinyurl.com/h2jj2ek)
2. Purchase the PICkit 3 Programmer + USB Cable (http://tinyurl.com/zcpx3le)
3. Download PICkit 3 Starter Kit User’s Guide (http://tinyurl.com/jyqfeuk)
4. Download MPLAB X IDE (http://tinyurl.com/hmehqja)
5. Download XC8 Compiler (http://tinyurl.com/h5g9k5l)



I can't fit everything in the article, so whatever extra I have, might end up here on my blog page. So be sure to check back regularly for more cool projects.

Next month, I'll be getting my hands dirty with some lessons and some coding, based off the PICkit3 Starter Kit User Guide from Microchip's website. It's a decent PDF, but if you're new to PICs, then it can be a minefield.

Wednesday, 11 May 2016

EPE: PIC Microcontrollers and the PICkit 3: A beginner's guide – Part 1



This month, I start an ongoing series going back to basics for PIC Microcontrollers and the PICkit3.

Over the coming months, I'll be covering everything from the difference between microcontrollers and microprocessors to Microchip's MPLAB X IDE, the PIC Low Pin Count Demo Board and the incredibly useful PICkit3 programmer tool. I hope to build a strong foundation of understanding for microcontroller programming and project design.

This month I look at the difference between microcontrollers and microprocessors, as well as Raspverry PI's, Arduino's and PICs.

If you've always to give PICs a try, but didn't know where to start, then this month is a great time to subscribe to Everyday Practical Electronics and read my monthly PIC n MIX articles.

You can buy it in PDF format online at http://www.epemag.com/buy-epe-online.html or you can buy it off from the shelf in your nearest newsagents.

To follow along with the articles, I recommend getting your hands on the following:
1. Purchase the PICkit 3 Low Pin Count Demo Board (http://tinyurl.com/h2jj2ek)
2. Purchase the PICkit 3 Programmer + USB Cable (http://tinyurl.com/zcpx3le)
3. Download PICkit 3 Starter Kit User’s Guide (http://tinyurl.com/jyqfeuk)
4. Download MPLAB X IDE (http://tinyurl.com/hmehqja)
5. Download XC8 Compiler (http://tinyurl.com/h5g9k5l)

I can't fit everything in the article, so whatever extra I have, might end up here on my blog page. So be sure to check back regularly for more cool projects.

Friday, 8 January 2016

Software Management


It's the new year, make a resolution you can keep and get on top of Software Management.

Check out my latest PIC N Mix column in Everday Practical Electronics where I talk about everything in Software Management from Compilers to IDE's, Repositories, Version Control and Bug Tracking.

You can buy it in PDF format online at http://www.epemag.com/buy-epe-online.html or you can buy it off from the shelf in your nearest newsagents.

Unfortunately not all of it makes it to the article, so check out the following links for more info:

1) Best Bug Tracking Software of 2015 - Capterra
2) List of Repositories - Wikipedia
3) Top 7 Version Control Systems - Smashing Magazine
4) List of Version Control Software - Wikipedia


Monday, 7 December 2015

Christmas Cheer with a PICmas Tree


This was a beast of a project, but I got it working and somehow fit it into one article just in time for the holidays. I've only been writing since August and this is my most ambitious project yet!

Don't forget to check out my latest PIC n' MIX article in Everday Practical Electronics, where I will show you how to build your own PICmas Tree, using the LPLC board from MJH Designs. I use 68 LEDs to make a festive looking LED tree that sparkles and glows for the festive season!

You can buy it in PDF format online at http://www.epemag.com/buy-epe-online.html or you can buy it off from the shelf in your nearest newsagents.

Happy Christmas to one and all and a Very Merry New Year!

Here's a tiny sneak peek of the PICmas Tree, see the magazine for a better picture and details of how to make your own.


Friday, 6 November 2015

How to Pick a PIC


Don't forget to check out my latest PIC n' MIX article in Everday Practical Electronics, where I cover how to choose a PIC microcontroller from over 1000 different PICs available on the market. I also talk about the hotly debated 8-bit versus 16-bit and 32-bit and their specific place in the world today.

You can buy it in PDF format online at http://www.epemag.com/buy-epe-online.html
Or you can buy it off from the shelf in your nearest newsagents.

Wednesday, 28 October 2015

DIY Digital Oscilloscope Kit

So, I've been buying a load of equipment from Bang Good. It really is a great site, with a lot of electronic equipment at a great price.

My latest piece of equipment is my DIY Oscilloscope. As most hobbyists know, oscilloscopes can be expensive to purchase, but this little beauty comes in around $24. Like the DIY Adjustable Voltage Power Supply in my last blog post, it comes unassembled. Well except for the 48 pin Cortex M3 processor from ST Micro Electronics, which would be difficult for most hobbyists. All the other components are straightforward enough to attach and connect to the right place. There is less documentation with this device than there is in the DIY Power Supply. This is slightly annoying when trying to figure out what components go where. There's also a lot more components on the board, so it will take longer to build. 

The device itself comes with a 2.4" TFT screen. Unfortunately it's not a touch screen interface and the 4 buttons have to be used to navigate the settings on the screen, which is a little awkward to use. It also comes with a BNC connector cable with crocodile clips. There are also 3 switches to select between GND/AC/DC coupling, voltage divisions and amplitude magnification. It does not come with it's own power supply and the 9V input must be supplied externally. It also does not come with a case, which would have been nice. 

It is fun to build these devices, although not trivial, it's even better when they can be used as a tool to verify all of our other projects. It's not a full on professional Oscilloscope, but it does have quite a number of useful features. There's Automatic and Normal sampling as well as the single shot. It can capture on either rising or falling edges. We can change the trigger level as well and change time division from 500s down to 10us. I have to admit anything above 1s is a little excessive for capturing on a scope of this type.

You can see the working oscilloscope in the 2nd attached photo, powered by the previously mentioned DIY Voltage Adjustable Power Supply. 

If anyone else has ever bought this and had issues with it, comment below and let me know what you think or if there's anything else you would change about it. 

If you're looking to purchase this kit, check out the following link at Bang Good.com: DIY Digital Oscilloscope Kit