Monday, June 3, 2019

AVR ATmega UV meter using ML8511

This device is a UV meter built on top of an ATmega8 microcontroller and a ML8511 UV sensor.
It measures UV light intensity and the UV index.

The ultraviolet index or UV index is an international standard measurement of the strength of sunburn-producing ultraviolet (UV) radiation at a particular place and time. It is a linear scale, with higher values representing a greater risk of sunburn. The purpose of the UV Index is to help people effectively protect themselves from UV radiation.

It features an LCD display that shows you all the measurements, a temperature sensor to correlate the output against temperature too, the UV led is attached to this meter makes this device particularly suitable to test glass UV lens. It also works with a 9V battery.
The LCD displays UV light intensity in mW/cm2, UV index, current temperatore, a light intensity offset, that this the difference from two values of UV, and the UV wavelength measured.
The light intensity offset is usefull to measure the real UV intensity reduction of a lens for example.
In my case the UV led mounted is a 3W@365nm, so I set the wavelength to 365, but one can change it using the menu that is accessible by long pressing the Select button.

For further information on the sensor library please take a look at my blog post here:


  • read risk disclaimer
  • excuse my bad english

Thursday, May 2, 2019

D01: 2*15W guitar amplifier built using salvaged parts

-- ref 2013 --

The D01, litterally Discarica 01, is a guitar solid state amplifier build from salvaged parts.

Speakers are from a ready-to-be-trashed TV, the wooden case is something laying around here waiting to be trashed, some of the components are taken apart from old devices, like the transformer.
Of course there's something new in this amplifier, but most of the parts comes from savaged hardware.

The preamplifier it's based on the Descrete FET Guitar Preamp by J. Donald Tillman ( It's a J201 N-channel JFET based preamp that sounds really good.
The signal goes than to a clean/dstortion selection switch.
The distortion section it's based on a modded version of the Electra Distortion Pedal, that runs with just one 2N2222 NPN transistor. The distortion section has its own volume.

The output is then routed to the main volume and then to the main amplifier board.
The amplifier board it's based on the TDA7297 2*15W dual bridge amplifier. It costs just a few euros the complete board shipped with headsink, so this time I've buy this one.

The two speakers are 4ohm, savaged from an old TV.
The power section of my built consists of a 220V to 15V transformer with a 30W output current. Because the rectified voltage was a little too high for my circuit I use a simple DC/DC stepdown LM2596 board to reduce the voltage to 9V.

I assembled all those things in a wooden case build from some recycled boards.

I must admit that this amp sounds really nice, it has a nice vintage look, and the distortion section sounds really fat to me, although of course its has not a big output.

  • read risk disclaimer
  • excuse my bad english

Thursday, April 4, 2019

HX711 load cell amplifier library for AVR ATmega

HX711 is a precision 24bit ADC IC designed for weigh scales and industrial control applications to interface directly with a bridge sensor.

A load cell is a transducer that is used to create an electrical signal whose magnitude is directly proportional to the force being measured.

The library you can find here is usefull to implement a weigh scale using the HX711.

References used to implement this library are
This HX711 Arduino library,
And that other library here

Methods to get raw values and unit values from the HX711 are provided.
Also you can find function to calibrate the IC.

Before using this IC you have to calibrate it against the load cell used.
The calibration task is split in 2 steps:
1) The tare raw value offset needs to be obtained, To perform this task you have to run the calibrate step 1 function without any weight on the load cell.
2) Using the tare raw value and a know weight put on the scale you can capute the scale value that is used to obtain the weighted value.
For this reason is important that the reference weight has a well know value.

Once you have obtained the scale value, you can use it to get weight, and you can also perform a new tare without having to calibrate the scale again.

The sample provieded contains all the step needed to calibrate the sensor and obtain raw and unit values.

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1Mhz.


  • read risk disclaimer
  • excuse my bad english

Saturday, March 2, 2019

Guitar pickup wax potting

I've a telecaster copy by Tradition Guitars, it's a tobacco sunburst from 2005 and it sounds pretty good for the price.

Times ago i shift the default ceramic pickup with a set of Alnico 5 Vintage Plus TRT1 by ToneRider. Those pickups sounds very very good! Indeed, I want to mount those pickup on another Telecaster model I've, but I do not want to leave the Tradition TL without Alnico, so, I've buy a set of FLEOR Vintage Alnico 5 pickups from China for less than 20Eur with shipping.
The set it's composed of course by a neck and a bridge pickup for Tele syle guitar, they are wax potted, magnets are Alnico 5, and the resistance almost fits the specification, namely neck is 6k7 and bridge is 6k3.

I was skeptical about those pickups, the delivery was really fast just 2 weeks, when mounted I have to change my mind. The Fleor set sounds as vintage as the TonerRider, the bridge one it's a little bassy sounding in contrat to the ToneRider, but overall they have really a good "feeling".
BUT, there's a BUT here, cause we are speaking about guitar pickup potting on this post, the bridge one was microphonic, as soon as I plug the overdrive on it starts hissing.
I've read comments from other buyer of Fleor, no one has microphonic issues, so I think mine was just an oversight.
To me this is the opportunity to learn how to pot a pickup, in fact so i did, and with the wax potting I've solved all the issues.
I decide to disassemble this pickup and pot it.
Guitar pickup potting is a process whereby the pickup coil are encaplusated in a substance that inhibits the coil movement that may cause oscillations and so hissing. Many new pickups are potting using epoxy glue, but old and vintage pickups use wax.
When I remove the tape around the coils of the bridge pickup I've notice that it was potted, but the wax does not soaks coils under the tape, it seems to me that the employee that pot this pickup forgot to leave this enough time in wax or do pot with the tape on it.

Warning! Paraffin is flammable and fumes may be toxics. Do pot in open environment. Potting is made at high temperature, pay attention to your skin. Everything you do at your own risk.

Here is the recipe I've used:
  1. 80% paraffin + 20% beewax
  2. put this mixture in a pot, then the pot in waterbath till the wax liquefy
  3. check the temperature, it should be something around 60degree
  4. put the pickup in wax, try to prevent the pickup to touch the pot
  5. leave the pickup there for almost 20 minutes
  6. take the pickup out and clean with a rag, then wait till it cools down
While potting you should see small air bubbles that cames out from the pickup, that's normal it's the air between coils that leaves the space to the wax.
I've pot both the pickup, just in case.

Reassembling the bridge pickup I've put the tape back, then wrap a cord on the pickup just to give it a vintage look.
To my surprise when i mount the pickups back, they both still works, and microphonics issue was gone!
This is how I potted the pickup, of course I'm not an expert on this field, so if you have suggestions or tricks put comments below.

  • read risk disclaimer
  • excuse my bad english

Monday, February 4, 2019

Bad Ragaz Fuzz - Germanium Fuzz pedal

Here i present a Germanium Fuzz Pedal I've recently build.

It happens that a friend of mine was about to throw away a late 60's record player. This record player was in his old house, the case of the player get wet and unusable due to a loss in the ceiling. This friend also throw away a steel boxfrom ELESTA AG, the plate reads: Bad Ragaz, which sounds like Bad Boy in a mix of italian and english.

I have disassemble it and take all the components out, to my surprise it contains a bounch of germanium transistors. So i decide to build this pedal.

The pedal design is simple, I just stared from the Vox ToneBlender original schematics, which is a Fuzz i really like, and change some values to match the sounds i like more with the components I have.

I've used two PNP germanium transistor: the SFT337, and the AC142. Then I changed the original ToneBlender fixed collector resistor with a Bias potentiometer, that define the Badness of the sound, because we are talking about a Bad Ragaz.

As a side note I must admin that altough germanium transistor sounds goods, they are slighly more difficult that to drive, as example microphonics noise can happens, and noise more in general it's around the corner.

Find below the schematics.

And the original Vox ToneBender

  • read risk disclaimer
  • excuse my bad english

Tuesday, January 1, 2019

Usa a MCP23017 GPIO port expander with an ATmega

The MCP23017 is a general purpose I/O port expander, it is driven using the I2C interface.
Each of the 16 channels can be set independently as an input or as an output pin.

This library provides functions to drive up to 8 MCP23017, it means you can expand your micro to 128 between input and output.

One of the interesting feature of this IC is the possibility to set an interrupt.
Interrupts can trigger a change on both INTA and INTB chip output, if mirror mode is selected a change on the bus A, or B trigger interrupts on both INTA and INTB.
One can also set the polarity of the interrupt, it means if the input gives you a high or low level on output.
Output interrupt channel can also be set as open drain.
You can set interrupt on each individual input channel, setting the compare mode, i.e. if the pin status has changed since the last reading, or if the pin has changed compared to a value set by the user. This last option is usefull if you want as example to set the comparation for rising or falling mode.
Then the interrupt can of course be enabled just for a single pin.

This interrupt features gives you the ability to quickly detect the change on a pin.

This library also provides function to set each individual pin mode as input or output, output pin status and read input pin status. Functions to read group of values for the full A or B channels as byte are also provided.

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1MHz.

If you want further information on that IC, i suggest you to take a look to that two interesting articles on that IC:


  • read risk disclaimer
  • excuse my bad english