May 18, 2020

Yamaha CR2020 service

I got hold of a Yamaha CR2020 that was in a pretty bad electrical shape, but very nice externals. As a hobbyist I planned to take my time and fix it properly.

I decided to do a full recap (replace all electrolytic capacitors). Well most of them. I actually left the radio and phono pcb as it was.

There are three Service Bulletins released by Yamaha for the CR2020. They all target the same problem area. Heat problem in the power supply area. One of them also target a problem with power switch waring out.

The main capacitor board is the worst heat producer. The PCB in this amp had become so hot that the PCB had become charcoal and the electrical traces lifted from the PCB.

The best solution I could come up with was to replace the PCB with a new one. There are no new to buy so I had to backward engineer the existing one. It is possible to buy on request (
Most of the heat is produced by four current limiting resistors. The original ones are mounted on the component side and in a way that generate heat in a bad spot. I googled the problem and found out that someone else had solved the problem. Mounting the heat generating components on the back of the PCB make it much easier for the heat to move away from the PCB.

The resistors is now located in a place where air circulates much easier.
-B and +B terminals are marked on the PCB. This is where the cables to the main board is soldered. They connect immediately to the capacitors. As a side note, I experienced the importance of isolation distance. After a full day of testing the amp and adjusting bias, I turned it off. The day after when turning it on, I heard a loud bang! It turned out that the +B cable was lying right on to the negative terminal of the capacitor. When switching on the amp the current flow to the capacitors is very high and thus the voltage shortly spikes. The voltage became so high that there was a spark through the cable isolation. After relocating the cable the problem was solved.

After the recap and restore was done, there was quite a hand full of retired components. All of them is not shown in the picture.

The capacitors where in a really bad shape.
The orange capacitors to the left was the only capacitors that still measured very good. The rest was in bad shape with many only having half the capacitance left. The capacitors in the rest of the red circles had a short circuit.

Closing up on the relay one can see that the contact pads are missing on one side.

The under dimensioned transistors TR712 and TR715 (2SD234) was upgraded to TIP41C and mounted on a big metal surface close to the faceplate. In the image below one can also see the new relay and the new green capacitor board.

Here is a close-up on the capacitor board. The two big capacitors are new 5-pin snap-in type capacitors.
The Main boards had a couple of short circuit capacitors but nothing else broken. However, I did change the potentiometer to trim the bias voltage and refreshed the thermal paste on all transistors. At the same time I checked that they seemed OK. The transistor to the right TR608 was changed since the 2SC458 is known to go bad.
Image below is before restoration.

Main boards after restoration.

The power switch came in a plastic bag. It consist of a mechanical part and an electrical switch part. The mechanical part was in perfect condition but not the electrical part. I 3D-printed a small bracket that made it possible to mount a micro-switch (CSM40550) to the mechanical switch.

And a final picture of the result.

September 29, 2017

Upgrading a Bosch PLL 360 self-levelling line laser

Based on my previous upgrade of the Cocraft HL-10 cross line laser, I was set to upgrade my PLL 360 cross line laser as well.

Analysing the hardware

I first opened the laser by locating all 5 screws.
One of the screws is hidden under the sticker.
It seem to be possible to adjust the accuracy if needed by adjusting the copper coloured screws.
The line laser is self-levelling as long as the line laser is keep within ±4 degrees referenced from the  bottom plate. If the inclination is greater, the inclination switch kicks in and turn off the line lasers at the same time as a warning LED turns on. This can be avoided by pressing the Lock key.
When the spring makes contact with the surrounding PCB, the lasers are turned off.
Behind the control panel I find the main PCB.
A simple construction.
Top-middle right is a step-down converter to bring down 4x1.5V to 3.3V to feed the microprocessor. Bottom right is the microprocessor. A PIC16F676 and a convenient ICSP header close to it (J3). Bottom left is the laser driver n-channel mosfets. Top-middle left is some pull-up resistors and current limiting resistors for the indicator LEDs.
PCB overview
After some measuring I could map all pins on the PIC the functions,
// PORTA-defines
#define H_LED        0  // OUTPUT RA0, Horizontal laser indicator LED
#define V_LED        1  // OUTPUT RA1, Vertical laser indicator LED
#define BATT_STAT    2  // INPUT RA2/AN2
#define WARN_LED     5  // OUTPUT RA5, Warning indicator LED
// PORTC-defines
#define LOCK_LED     0  // OUTPUT RC0, Lock indicator LED
#define V_CTRL       1  // OUTPUT RC1, Vertical laser control pin
#define H_CTRL       2  // OUTPUT RC2, Horizontal laser control pin
#define MODE_BUTTON  3  // INPUT RC3, Mode button
#define LOCK_BUTTON  4  // INPUT RC4, Locked mode button
#define LEVEL_TRG    5  // INPUT RC5, Level switch

The BATT_STAT is never used. The pin is connected to battery output, probably to be able to sense when the battery is running out of juice. I did not find the point in implementing the voltage sensing function.

Adding a HW interface

The J3 connector can be used to connect to the PIC microprocessor.
Pro tip. Solder the cables from the bottom and up, if you'd like to keep the programming cables after closing the line laser.
Once the header has been populated with wires and a pin-header I connected it to my Pickit2.
To my surprise there is no read protection of the original software so it could be extracted and saved. That can be useful if something goes very wrong and I need to revert back to the original line laser firmware.

When the programming is done, the programming header can be tucked away along one side of the line laser. I taped it to one side just to make sure it does not fall loose and start to interfere with the self-levelling mechanism.

The original firmware function

The original firmware have a few basic features.
The Mode button selects which one of the two lasers should be lit. The horizontal laser, the vertical laser or both lasers.
The Lock button disables the internal inclination switch so that the line laser can be used at any angle.

The new features added with my new firmware

I have created two modes. Indoor mode and outdoor mode.
The indoor mode has exactly the same features as the original firmware except for one thing. The last used setting is saved in EEPROM and is recalled when turning on the line laser next time.

The outdoor mode is exactly the same as the indoor mode except that the lasers are pulsating at 2.6kHz.
By pulsating the lasers it is possible for a line laser detector to detect the lasers outdoor in bright daylight. This is a feature that is usually found in more expensive line lasers.
The outdoor/indoor mode is toggled by holding the Mode button while turning on the line laser.

The outdoor mode has been tested with the cheap Clasohlson laser detector,
The detection range is measured to be at least 55 meter outdoor.

Talk is cheap. Show me the code.

The source code is written in C for the XC8 compiler here,

The latest hex-file (pll360-outdoor-upgrade.hex) can be found and downloaded here,

August 29, 2017

Upgrading a cheap cross-line laser leveller

When I started to build our greenhouse, I had a cross-line laser to make sure the build progress was done in level. The problem I had was that the cross-line laser I had was impossible to detect during summer days, so I had to wait until late evening to verify if all was still in level.

The easy solution would be to buy a laser line detector. But that would set me back at least $60. On top of that I would have to buy a new line laser that is supported by the line laser detector. That kind of line laser cost from about $200 and up.

I found out that the detectors usually rely on rotating laser light. Rotating since the detector only detect blinking light. Outdoor a constant light source of a specific color does not make much of a difference compared to the background surrounding light for a light sensor, but by adding a high pass filter to the light sensor, only pulsating light will be detected. Everything else is filtered out.

OK, so I had to adapt my existing line laser to emulate a rotating line laser. I had to make the laser blink at a certain frequency. The line laser I have is this one from Clas Ohlson, Cocraft HL10-S

There is a feature on many line lasers that the laser is turned off if the laser device is inclined too much in any direction. Mechanically the laser emitter is positioned in a pendulum that is hinged in two directions so that it can freely move with gravity. The lower end of the pendulum is hanging down into a hole. If the laser device is inclined too much, the pendulum will touch the side of the hole.
Electrically that will close an electric circuit that in turn will turn off the laser light emitter.
This mechanism I will use to flicker the laser light emitter.

Opening the laser device, I found the soldering pads on the PCB that corresponded to ground(GND), power(Vcc) and the inclination trigger to turn off the laser.

Measuring the signal level on the inclination trigger showed that it was either 0V or Vcc.
Manually forcing the inclination trigger pad to Vcc turned off the laser emitter. Thus, I only needed to create an astable multivibrator that generates a high enough frequency square wave and connect that signal to the inclination trigger. What frequency is needed I still had to find out.

To start experimenting I of course needed a laser line detector. I ended up buying the very affordable, Cocraft D50 Pro edition.

Moving on with the astable multivibrator. I based it on a 555-timer that only need a few extra components to generate a square wave. Here is the electrical diagram and component values I ended up using.

It turned out that the detector start to detect the laser when the beam blinking frequency is over 340Hz. I ended up using a 1kHz square wave with a 67% duty cycle. I soldered all the components directly on the 555 IC, in a "dead bug"-style.

The circuit was enclosed in a white shrink tube and tucked away inside the line laser enclosure.

Testing my new "rotating" line laser with my laser detector outside showed a detection distance of at least 40 meters. All in all it  set me back $38 for the line laser, $50 for the detector and less than $1 for the astable multivibrator circuit.

Mission accomplished!

PS. I first planned to make my own line laser detector. But I realised that it is hard to motivate considering the time to develop and component cost, when I could buy one for $50.

June 1, 2017

New product in the store: Slot car programmer

The new product is called SSD Slot Car ID programmer. The main purpose is to assign Slot car IDs to Scalextric Sports Digital slot cars. In a typical usage situation the slot cars for the upcoming race can be programmed with the correct car ID already before the ongoing race have finished.

It can be controlled by either pushing the button, or by connecting a computer to the serial interface. The serial interface configuration need to be TTL level and 1N8 19200. Sending any character 1-6, will set the car ID to respectively address.

Here is the manual for more information.

December 2, 2016

Wireless Pulse Counter 3 (WPC3)

I have updated the firmware to support the Telldus products.
For Telldus products it is needed to convert the received data into Energy and Power consumption.
An example how this is done can be seen in the file wpc-calc.c here.

Another update is the 1-wire support. Now the WPC can communicate to the same 1-wire-devices as the WMS mk3.
  • DS18B20
  • DS18S20
  • DS1820
  • DS18B22
  • DS2450
  • MAX31850K
Of course is the DHT22 also supported.

The new Wireless Pulse Counter 3 (WPC3) is available now in the foogadgets store.

May 30, 2016

Soon: Wireless pulse counter (WPC2) to support Tellstick DUO/NET

I am currently working on adding support for Tellstick DUO/NET to the WPC2. The support will be implemented in the same way as the old WPC.
The 1-wire support will at the same time, be extended to be compatible with more devices.
Beta testing is ongoing.

February 5, 2016

New CO2-sensor support for the WMS mk3

I have implemented support for an additional carbon dioxide sensor that is much cheaper and easier to get hold of compared to the S8 sensor from SenseAir.

The new sensor (MH-Z19) can be found on eBay or Aliexpress from $26 including shipment.

Of course there are differences between the two that is reflected by the price.

I have setup two WMS mk3 side by side. One WMS with an S8 sensor and one with an MH-Z19 sensor. The result is logged to ThingSpeak

The MH-Z19 variant used have a range from 0-5000ppm. As the digital output on the MH-Z19 only can be 0-1000, every digital step represents 5ppm. This probably contributes to the jagginess in the graphs presented below.

First observation when comparing the two graphs is that the MH-Z19 sensor gives a much more jagged curve. Both graphs have the same shape which indicates that the response time is about the same for both. The MH-Z19 has however a slower response time.

The left half of the graphs below should be close to 400ppm as both sensors was placed in the opening of a window. Outside air can be used to calibrate a CO2 sensor since the open air CO2 concentration is constantly very close to 400ppm.

A feature that the MH-Z19 is lacking compared to the S8 is auto calibration (a.k.a. ABC - Automatic Baseline Calibration). The ABC continuously keeps the S8 sensor calibrated.

This picture shows the difference between the two. The timescale is 1 hour.
This second image shows that the MH-Z19 averages out to shape the same graph as the S8, but the readout is not very smooth. The graph spans about 1 hour to make the comparison more obvious.

Another image that shows the jagged graph from the MH-Z19 sensor.
In the graphs below I had added a +45ppm offset to the MH-Z19 sensor readings as I thought it was showing around 45ppm too much compared to the S8. After calibration I reconsidered and had to change the offset factor to -30ppm. The offset change can be seen at about 14:50. When zooming out the comparison between the two is more fair.


The price/performance ratio for the MH-Z19 is good, and I think it is worth its price and good enough to measure the air quality in an apartment or house. The S8 on the other hand seem to be very much more accurate and there is usually no problem to detect presence of one or several persons in my 97m2 apartment.

I will update the blog when the 0-2000ppm MH-Z19 sensor arrives. That variant is likely to give better results as the resolution of the output is 2ppm per step.

Note that the output of the MH-Z19 is always 0-1000 which is shown by the WMS as 0.0°C - 100.0°C
To convert this to a proper carbon dioxide ppm reading, the temperature need to be multiplied by 50.0 for the 0-5000ppm MH-Z19 variant, and by 20.0 for the 0-2000ppm variant.