A couple of months back (April if I recall) I was bored and looking for a nice project to kill some time in a rainy saturday. I decided to build a nice night light for my bedroom. I had a set of restrictions put in place so that I would be pleased with the final result, these were:
Must run on AAs
Small and cute
Should be built entirely with parts that I had on hand
The first challenge was to find a nice enclosure, since this was going to be used as decoration it couldn’t just be a bare protoboard with some LEDs or a boring project box. While looking through the pile of stuff (most people would call trash) I had stored in various places around the house, I found a couple of cubic flower pots made in various materials. I thought the ceramic one would fit my bedroom quite well, so that part was done.
The next thing would be to find a diffuser to cover the LEDs and and give a more uniform light. My first idea was to use acrylic or something like that, but sadly I didn’t have any on hand so I had to improvise. Again I went looking through my stuff and found an empty Ferrero Rocher enclosure (I knew I would use it some day), all I had to do was sand and cut it so it would fit the flower pot.
The last and most boring part was to solder all the LEDs, they are in a series parallel arrangement, with 9 parallel groups of 2 in series so that I could use a 9V supply. For driving them I decided to build a simple constant current sink with the two NPN transistors in a feedback configuration and designed it in such a way that it would be adjustable up to 100mA.
If you want to see more pictures of the whole process they are all available in this album:
Recently I bought a couple of those super ultra cheap cigarette plug extensions to distribute 12V in the lab for various things. As usual with everything chinese, I decided to open it up to see how horrible it was inside, but I also did that to upgrade the wiring since I would be pulling a couple of amps from this and I want to minimize the voltage drop.
This is the incredible thing I found inside the thing as the 5V supply for the USB socket. A 7805 regulator and a 20 ohm 1/4W resistor in series with the 5V output. I guess it could have been worse, they could have used a 5.2V zener or the worst of all just a resistive voltage divider.
First of all a bit of a back story: This is my first attempt at a DC-DC converter, I’ve always thought they were magic black-boxes that you just had to accept and building one yourself without a dedicated chip was something extremely difficult, something that could only be done with some high-speed complex analog circuitry or high-speed microcontrollers. I think a lot of people think the same way and I decided to try out my luck and it worked fine, switchmode converters are not black magic (now only RF is black magic), and I hope I dismistify them for you too in this article.
The idea for this project came because I built a nice portable Class-A headphone amplifier (blog post coming in the future) and I wanted a simple power supply for it when I was using it with my computer, so I had to step the 5V from the USB to the 9V required by the amplifier circuit, the amplifier even though it’s Class-A has a low current consumption, so the 2.5W from a normal USB was more than enough. Taking into consideration all this I needed a boost converter with the following specs:
5V input at 450mA maximum to work with any USB port
9V output able to source up to 110mA (more than enough for my amp)
Acceptable voltage ripple and noise since this will be used with pre-amps and the headphone amp
As you can see there’s not a lot happening, and that’s the beauty of this design, since it was made for low power projects it doesn’t require any of the complexities, it was designed to be minimalistic and easy to build for someone that is new to switchmode converters. The entire feedback control loop is contained inside the PIC12F683 microcontroller, it is a pretty tiny and under-powered micro, but as you will see it works perfectly for this task.
First the power input goes through a 3.3V regulator which provides power to the PIC and also acts as a voltage reference, then the microcontroller takes control of things and starts the PWM, pulsing current through the main inductor L1 while sensing the output voltage, if the voltage is lower than the set voltage it increases the PWM duty cycle, if the voltage is higher than the set voltage it decreases the PWM duty cycle, and that’s all you need to create a simple switchmode converter. Here’s the code that runs the whole thing (I still need to improve it, so changes are coming):
If you’re a bit more experienced with DC-DC converters you’ll notice that the components used are a bit overkill, but that’s by design because I wanted very low ripple at the output, also in the topic of components, I selected a IRL520 MOSFET and this is very important, since I’m driving the gate with very low voltages a logic-level MOSFET is a must, if you want to use a regular MOSFET you’ll have to increase the gate voltage using a technique shown here.
A very handy tool for everyone designing their own DC-DC converters is Adafruit’s DIY DC-DC Boost Calculator, it was extremely useful to choose the components used in this project and it’ll surely help you in yours too. I’ve also written a R script to have a offline version of the calculator, it’ll be improved in the future, but it’s usable right now.
The only issue that I’m having with this project so far is the fact that no matter what I try, I can’t get the crystal to oscillate, I checked everything, set all the registers correctly and I still can’t get it to work, if anyone wants to help it’ll be greatly appreciated.
Since all my designs have a lot of local decoupling to keep any noise or ripple from the power source away from sensitive parts I didn’t care too much about having extremely low ripple/noise, but if you want to upgrade this you can add a small shunt regulator to really kill any ripple or just add a LC filter to the output.
If you’ve got any questions feel free to ask and I’m open to suggestions for improvement.
Sorry for this extremely long break, I’ve been extremely busy with a bunch of stuff from university and wasn’t feeling inspired to write any blog posts, but now I’m hopefully back and I have a lot of plans for interesting future posts.
This year I got overwhelmed by a shitton of university assignments and to top all that I’ve been exposing my projects at a bunch of trade shows together with my friends. If you’ve ever exposed things in trade shows you’ll know that it’s extremely stressing (before, during, and after) and time consuming, so I’ve been putting a lot of effort into that. The last trade show I’ve been to was called InnovaCities and it happened in Foz do Iguaçu, pretty far from home, and I had a great time there showing a much improved version of the lightwave transmitter and a automatic shower and sink that focuses on saving water which was a project I did with a friend that had the idea. We even had the pleasure of meeting some polish researchers and the prince of Nigeria.
Of course during this year I did a bunch of projects for myself including headphone amps, pre amplifiers, battery chargers, LED lighting, electronic loads, power amplifiers, and a lot more! I’ve also been experimenting with DC/DC conversion and power inverters which will be subjects of future blog posts.
One of the most notable projects I’ve been working on almost during the entire year is a battery capacity database ,which I plan to include all the batteries I can find, and be extremely helpful to determine which battery to buy next or estimate the battery life of your project with a certain battery, I’m currently working to create mathematical models of each battery. I’m so focused on this project that I’ve ditched the old super simple electronic load, which consisted of just a potentiometer, a op-amp, and a power transistor with a data logging multimeter, to a much better, automated, computer-controlled load that I named miniload. Discharging batteries now is a lot faster and a lot less problematic.
I’m back with another amplifier project, but this time it’s kinda like a remake instead of a completely new amp. The story behind this project started 4 days after I completed the Mini6.
While I was drilling the holes for the jacks on the Mini6, I accidentally put too much pressure on the acrylic enclosure and it cracked, it was very small crack, practically impossible to see, between the two RCA jacks on the front, but after using it for a while and noticing how the crack would open a little bit every time I plugged something in, I decided to fix it using super glue (facepalm) and while I was using the glue I didn’t notice that one small drop fell in the PCB. I put everything back together and tested, it sounded horrible and when I looked inside I could see the stain of the glue which was destroying the sensitive part of the circuit. So in a moment of rage I decided to throw the whole amp in the trash and design a better one and put it in a better enclosure. So that’s how the Power12 was born.
The first thing I did to the original design was add a Zobel network to increase the stability of the amplifier. The other modification I did was the addition of a active load in the gain stage. Sadly when I was designing it I forgot to add another active load for the differential pair, but this will be fixed in the next revision of the board (I’ll also add a SIM).
Populating the board was a pretty straight forward process since there aren’t a lot of components to be placed and as usual the most difficult port was soldering the spade terminals to the ground plane.
This time I decided to use a very nice extruded aluminium enclosure that I found on AliExpress. I was a bit skeptical at first about the quality of the enclosures, but when they arrived I was surprised how beautiful they were, and the quality of the extrusion was really good. The seller was great, emailed me to ask about the customs, shipped extremely fast, and packed everything extremely well to make sure nothing would scratch the very fragile black paint of the case and the panels.
Since I decided to use a aluminium enclosure, the best combination would be a very minimalist design, so the only thing in the front panel is the power switch. This decision gave me the idea to place the power LED on the back, giving it a really cool look when it’s powered on.
Drilling the holes for the 2.1mm power connectors was a pain in the ass since I didn’t have a drill bit that was bigger than 8mm, so I was forced to use the “wiggle” technique to make the holes bigger and because of that the drill bit escaped the hole a couple of times and damaged a bit of the back plate, but since it’s on the back no one will ever see my mistakes.
The distortion figures are not the best you’ve probably seen (it’ll be a lot better when I add the second active load in Rev B), but it’s low enough that you won’t be able to notice it. The plot was created using a script I’ve created called plot_thd.py, running this SPICE circuit. Sadly I don’t have the equipment to measure the real figures, but I’m planing to buy a Keithley 2015 next month.
One thing that I actually was able to measure was the temperature profile of the amplifier, and as you can see it runs pretty cool with those FA-T220-38E heatsinks. Those figures were measured with the lid closed and with the amplifier right at the point of clipping with a 1kHz sine wave into a 8 ohm load. I’ve used my Agilent U1242B multimeter in conjunction with a program I wrote called dmmlog to grab the data, then plotcsv to generate the graph you see. Sadly I forgot to take pictures of the test setup.
If you want to see all the pictures of the project this Imgur album contains all of them. If you want to have access to all of the files related to this project check out the GitHub repo, and if you want to discuss it the best place to go would be the diyAudio thread.
Since I was tired of using the flash circuit hack (my version) to power my tube experiments I finally decided to build a isolation transformer using two identical step-down transformers as suggested by Mike in his nixie clock documentation. Here are some photos of it:
I’m planing to build a adjustable HV lab power supply in the future (which I may sell as a kit), so stay tuned.
As I’ve described in Unbelievable Prices, I bought a crappy chinese MP3 player to use as a “true” sound source (instead of the function generator I use while early-testing my audio projects) for testing my audio circuits without having to worry about accidentally shorting 12V into my iPod’s headphone jack or something like that while probing around.
Yesterday it arrived and as it was expected, it’s the best of Shenzhen. Horrible plastics and build quality, the buttons are super stiff, and overall a shitty product as it was expected to be, but since I’m only going to use it for testing, I don’t care. Here are some pictures of the “beautiful” thing:
As you can see it’s a typical chinese product. The LiPo battery has no markings, except for a weird XI logo, it doesn’t look like a protected pack and the flimsy wires that connect it to the main board can snap off at any second and short the thing out.
Right next to what looks like the main processor, which sadly I couldn’t find any information about it, there’s a very nicely heat-shrunk clock crystal. On the center of the board you can see a generic 4871 audio power amplifier, and on the left side there’s a BK1080 FM receiver IC.
On the other side of the board all you can see is the horrible LCD and the shittiest buttons you can buy in the Shenzhen market.
This week I’ve been experimenting with a very simple and cheap project for wireless transmissions, a lightwave AM transmitter and receiver based on Scott’s design, which was based on VK2ZAY’s design. In my final design I’ve increased the base biasing resistors to decrease the size of the coupling capacitor and also used a darlington transistor to get more current gain.
The transmitter is pretty straight forward, the input modulates the current passing by the LED, which modulates the intensity of light, if you’ve designed any class A amplifiers in the past you surely know how it works. The receiver is just a simple transimpedance amplifier, which is amplifying the signal quite a bit (~56x gain) since the transmitter will usually be a bit far from the receiver. You can do the same with a op-amp, but I much prefer a discrete circuit for these simple things.
You can put a buffer stage with a darlington emitter follower on the output of the receiver so you can drive a speaker directly. Something that I would recommend is to add a small (10x gain maybe?) pre-amplifier for the transmitter, that way you’ll get a bit more signal if you’re source isn’t very loud, specially if you want to drive some high power LEDs, since you have a lot of current headroom with those.
If you want to experiment with different values in a simulation, here is the LTspice schematic. The best way to choose the best LED + photodiode combination to maximize the range is to build some breakout boards that you can plug different LEDs and photodiodes until you have the perfect combination.
Since I’m building a bunch of audio circuits lately and I usually have to test them using a “normal” sound source (after extensively testing it with my function generator), I decided I should buy the cheapest chinese crap MP3 player just to protect my phone or any audio source that I’m using. The last thing I want is to short something or accidentally apply a (relatively) high voltage to one of the audio pins, or do anything that could damage my device.
So, I quickly went to MercadoLivre, the brazilian version of eBay, and searched for the cheapest ($3 multimeter quality) MP3 player available, and sure enough, this popped up. It always amazed me how cheap they can produce this sort of crap, but seriously, $6.31 with taxes and all for a device with a shitty color display and all? That’s just insane, they are probably assembling millions of those to be able to produce them at that price.
So, in a nutshell, I’ve bought this piece of junk which will happily suit my needs, since it’s so fucking cheap that it can be considered disposable.
Recently I’ve started using my Jornada 720 as a replacement for my iPad as a lab computer since it’s extremely tiny (space is very important in the bench) and can do practically everything I need my iPad for, of course I still have my main computer in the lab to program microcontrollers and do everything, but the Jornada is great to have near my working area so I can quickly check datasheets, schematics, and parts list while soldering or prototyping.
Usually when I’m prototyping or testing a board I have to check datasheets for pinouts, common voltages, etc. and Adobe Reader is great for this task:
In my main computer I keep a very well organized folder (and database, but I’m still researching the best way to get the DB into my j720 and keep them both synced) with datasheets for practically every electronic component I have in stock. So whenever I update the folder with more stuff I just rsync everything to my Jornada, and since it’s a nice Linux machine I’ve already wrote a nice script to automate things.
Last, but certainly not least, I’ve built a small command line application a while ago called build-bom which gets a schematic file from my CAD program (EAGLE) and can output the parts list into HTML, CSV, or JSON. So whenever I’m populating a board I export the parts list to HTML and open it in my Jornada so I can know which part to place where in the board: