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.

September 22, 2015

UNI-T UT61E modification

To create my foogadgets I need tools. Some tools can be upgraded and improved.
One of them is my multimeter UT61E from UNI-T that is a pretty good multimeter for the hobbyist.

The onboard processing chip ES51922 have more features than is presented to the user. This hack enables some of them.

After the modification my multimeter have the following additional features;
  • Backlit LCD with backlight auto shut-off
  • DMM auto power-off after 15 minutes
  • Possible to Enable/Disable RS232. Default is to have RS232 Disabled
  • MAX-MIN mode for Frequency and Duty cycle measurements
  • AC Low Pass Filter mode
There are some more tweaks to the tweak that can be done;
  • Increase LCD backlight shut-off time from 60 to 180 seconds by connecting BKSEL (113) to VB_ (-3V). It is floating by default
  • Increase the auto power-off time to 30 minutes by connecting APOSEL (112) to VB_. Default is floating.
For this modification there is no need to add any extra buttons. By putting a microprocessor between the function buttons and the DMM processing chip, it is possible to add more modes to some of the buttons. For the Blue and the Yellow button there is only one mode, the short press-release.
I add more modes that is triggered by long-pressing each button or by pressing both buttons simultaneously or by holding down the yellow button while powering on.

This is not my own hack but rather a compilation of already existing hacks with some additions.
I have however not seen anyone done this with a PIC from Microchip. Nor using the PIC to drive the LEDs to protect the MM processing chip.
I have also enabled the LPF in AC-mode which I have not seen been done earlier.


  • 2 pcs LED. The forward current must not exceed 3V
  • 1 pcs Resistor to limit the current to the LEDs. Its value depends on the LEDs forward voltage drop
  • 2 pcs Resistor as a voltage divider for the BKOUT signal. Around 40k-60k should be OK.
  • 1 pcs PIC16F688 microprocessor from Microchip
  • 1 pcs 0.1uF capacitor for decoupling the PIC16F688
  • Thin connection wire
  • Hot glue and super glue is good to have
  • PicKit2 or PicKit3 to program the PIC16F688 microprocessor

The modification

Download the source code from here,

Build the hex-file.

Flash the PIC16F688 with the generated hex-file.

Solder the decoupling capacitor between pin (1) and (14) on the PIC.

Solder thin cables on all pins except pin (4).

Here is a video of the final result,

Some pictures;