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, http://www.clasohlson.com/se/Laserdetektor-Cocraft-PRO-Edition-D50/40-9978
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,
https://bitbucket.org/foogadgets/pll360-upgrade

The latest hex-file (pll360-outdoor-upgrade.hex) can be found and downloaded here,
https://bitbucket.org/foogadgets/foogadgets-document-and-firmware-download/downloads/

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.