Wednesday, December 6, 2023

Vintage IBM 5160 XT PC restoration


The IBM Personal Computer XT model 5160 is the second computer in the IBM Personal Computer line, released on March 8, 1983 (https://en.wikipedia.org/wiki/IBM_Personal_Computer_XT).
I've found one in the dumpster, belive me or not someone throw this piece of hardware away.


By a first visual impression it has the monitor plastic case damaged, I think it was due to the way the previous owner throw it away, also the keyboard is missing.
As usually happens with PC of this hera that haven't been boot for a while, the first boot was an explosion. So I decided to disassebly it and take a look inside.
It turns out one tantalum is gone. I've removed it and checked for other problems.


I've found another tantalum is in short. I've notice they are on the + and - 12v lines.
I've read on the Vintage Computer Federation forum (https://forum.vcfed.org/) that tantalum problem it's a common issue on the +-12v lines.
I've replaced all + and -12v caps, since they are not many. At first I've replaced it with 10uF ceramic, then I've moved to something next to the original one.
I've ended up replacing all the tantalum on the +12V, -12V and -5V line with new 10uF tantalum 16V caps. The one I've found has 2 pins, indeed the original one has 3, but this is not a problem since 2 of the three pins are shorted.
Once replaced I've boot it up... and it works!


But... the boot process ends up with an error. I've investigated further on this, that was an error referred to the missing keyabord.
I've found an XT type keyboard, and plug it.
And finally... it boots!
It's Microsoft MS-DOS 3.30 Italian version.
My PC has:
  • Type 13 20mb WD25 HDD clicking on IBM 5160
  • 5.25 floppy drive with it's driver board
  • Video card
  • A Serial port board
  • A mysterious board
  • Monochrome green phosphor CRT monitor
On the front there's the sticker of a shop that sold it, now of course it closed, it was called Master Audiovisivi Studio. Indeed the mystery board it's a AV board, AVL Genesis, a rare ISA board for AV production. Find more info here: https://www.stevenmichelsen.com/AVL/


Now it's time to repair the monitor case. By using Fusion 360 and design an upper plastic cover to hide the plastic damage and repairing the monitor case by soldering it's plastic with an soldering iron. The result it's pretty good.


After a couple of month I've try to boot it up again, and it stops working... better saying, it works after a few time I try to power it on. Hard drive it's not recognised and the boot process does not start.
Long story short, it was a PSU issue. It takes me a while to solve this, but finally was done and working again.


Thanks to the people at https://forum.vcfed.org/ forum and eevblog forum https://www.eevblog.com/forum that helps me in this restoration!
My IBM vintage PC it's now good to go!


Notes
  • read risk disclaimer
  • excuse my bad english

Monday, November 6, 2023

MicroProto, a micro protocol for data exchange between devices


MicroProto is a mini protocol for data exchange between devices.

It is build and tested over the serial communication protocol, but it can be ported to others.
It is designed to send strings and byte arrays.
MicroProto is a variable length, in the current implementation you can send up to 999 commands, and 999 byte long byte array.

The command structure is the following:
STX|ACK|NAK DATA CRC ETX

Command parts are:
  • STX (hex 0x02): command begin 
  • ACK (hex 0x06): acknowledgment command begin
  • NAK (hex: 0x15): negative acknowledgment command begin
  • DATA: byte array
  • CRC: 1 byte CRC code
  • ETX (hex 0x03): command end
Send command can request an acknowledgment to be sent back. The acknowledgment command must start with ACK or NAK byte.

The ESC special char (hex: 0x1B) is used as escape character. Indeed if a ETX byte is sent in DATA, it is preceded by the ESC character.

Each command must have a CRC hex byte, this prevents communications errors.
CRC function is CRC polynomial x^8 + x^7 + x^2 +1  implemented using a lookup table to speed up the computation process.

Errors in communications may happens, due to timing or interference. However I'm using this protocol with decent results.


Embedded side, there are two ways this protocol process input data: "blocking" and "timed".
The blocking way try to read input from the selected channel, that is UART in this example. If a char is read, then the next one is processed, till the the end of protocol command, or till the threshold wait time passed.
In the timed way, two function are involved, one that read characters, and another that can be called to get the last command found. Most of the works is done inside the read/input function. This function read one, or up to a threshold bytes until the end of protocol command.
On both function a few other error preventing mechanism are implemented.
The timed functions most of the time it's the way to go, cause it does not stop the working loop that much. One can even put this function in a TIMER, and use the read last command function in the program loop.

There are a few parameters that can be set inside the header files, above all involve timing.

Send/Get character functions are passed as parameters during initialization, this makes this library portable to a few microcontrollers, and also to other than USART bus.

Indeed this library is been tested on
  • AVR ATmega/ATtiny
  • ESP8266
  • ESP32
  • Arduino Framework
  • STM32 family with HAL framework
A NET C# client library is implemented for test, you can use this library as a starting point to write your own client library or use the code straight in you .NET project.


Code

Notes

  • read risk disclaimer
  • excuse my bad english

Friday, October 6, 2023

Vorwerk VK-140 Folletto vacuum repair

Folletto vacuum cleaner are made by Vorwerk https://en.wikipedia.org/wiki/Vorwerk_(company) and sold here in italy with the brand of "Folletto" (Elf in english).

I've found a VK-140, that is a model from 2005 almost. Mine seems pretty new. I think it has been used just a couple of times. However it doesn't work. The main motor does not spin.

At first I though there was a problem with the power cord. I've opened it and checked the main voltage. The power cord, and the main switch works.

It's the first time for me to see a vacuum cleaner with an electronic board, usually there's just a simple main AC voltage brushed motor. This time there's some kind of elecontric to drive the motor.

Investigating further I've find this is a switched reluctance motor motor. IGBT transistor are used to drive the motor.

The power section has 4 G10T60 IGBT (600V 10A) and 4 D04E60 dioed (600V 6A).

The core of the controller it's a PIC18F24K20.

Between the MCU and the power section we can find an high-side / low-side gate driver, the FAN7382.

The motor spins using hands, so it's not locked. A visual inspection does not reveal any compoent burned.

I only hear a three clicky sound when trying to power the vacuum on.

Continuity on the motor seems ok, 1.4ohm almost for each winding.

First investigation goes to the Mosfet and the power diodes. I've cheked them removing the motor and checking continuity. Nothing seems shorted. I've also try with the diode testing, and all seems ok.

Then I've attached my portable DSO150 oscilloscope to the main output. It has 50Vpk as max input voltage, so using a 10x probe I can test up to 500V. I've not use my main oscilloscope cause I was going to test something that's potentially is on the earth ground, take a look at this video for further information https://www.youtube.com/watch?v=xaELqAo4kkQ. I've attached it directly on the motor input and checked the output.

Seems there's nothing on the one channel. So I've sone something I could have save, I've removed all the power section compoents (the igbt and diodes) and checked on the bench, they are all ok. Maybe I should have skipped this test.

Now I've tested the boost diode of the FAN7382, in one channel there's a short on the diode. I've removed it and checked alone, but it was not the diode. So it should be something related to the FAN7382.

I've ordered a couple of this IC. Soldered all back and voilĂ , it's working.

Maybe I should save myself some time checking it directly without desoldering all the power section, but most important is that I've repair it, and I've learn something.

Notes

  • read risk disclaimer
  • excuse my bad english



Friday, September 15, 2023

Mono Speaker for mixing using a Tannoy ceiling monitor

This is the mono cubic speaker I've built mainly for mixing audio.

It's been a few month that I want to add a mono speaker to my mixing station. Switching to mono for the mixing process is something well know and used for years, in the last years the Avantone MixCubes became popular for this reason.

I want something similar, so I decide to built it. I've one Tannoy CMS401e speaker not used. That is a ceiling monitor system is suited to high-level music and speech reinforcement applications.

This speaker has a transformer taps, which is used for distribution system. In my case I disabled the transfomer, cause I've just connected the speker directly to the amplifier board.

I've used a TPA3118 amplifier board. Supplied by a 12V 3A swithing power. The stereo input jack simply connect the tip and the ring with a 1k resistor, this will mix the right and left signal to the mono input of the amplifier. Before the amplifier input there's just a simple 50k potentiometer used for the volume.

I've build the case using an old speaker case. I've cut it to a cube and glue. Then I paint using dark wood varnish.


 The Tannoy speaker can also rotate a little bit, so that the direction can be adjusted. This is a plus for me, I can point it strait to my face.

The finish product looks pretty good. And the sound it's of course not as good as a stereo system, but that's exactly how I want it to perform.

Notes

  • read risk disclaimer
  • excuse my bad english


Friday, August 4, 2023

San Pellegrino Terme Germanium Distortion pedal

I've been in San Pellegrino Terme (https://en.wikipedia.org/wiki/San_Pellegrino_Terme) this winter.

San Pellegrino Terme is a thermal location, so I had a vacation there. I bought a tin of candies which I'm using as the case for this guitar/bass pedal.

This is why it's called the San Pellegrino Terme Distortion.


 A few weeks later from this vacation I've found a 70's radio in the dumpster. That radio has a couple of germanium transistor on board.

I've desoldered them and I've decided to use as soon as possible, cause they are not branded and I do not want to keep htem in my germanium transistor drawer.

They are PNP germanium transistor measuring 180 hFE. Gain is a little low but that would not be a big issue. I take as reference a classic 2 transistor distortion configuration.

Indeed I've decoupled the output from the first transistor and input that output to the second transistor, forming a two stage gain.

I've try to push the gain to the limit.

No controls available, just the output volume.

True bypass, and a active led output.

This pedal is not going to start a revolution, it's just a simple distortion build from unknown components in a tin of candies, but I like it.


Notes

  • read risk disclaimer
  • excuse my bad english

Monday, July 10, 2023

X/Y label plotter to vinyl cutter and pen plotter conversion using grbl


I've a found a plotter. The VP600 Basic by Brady is a X-Y pen plotter for tag.

Of course there's some part broken and missing.

The pen holder and the power supply are missing, the plotter has a dent on one side, software is missing and also I'm not sure electronic is working.

I disassembly it, repair the dent and check that the X-Y mechanism is working.

It has a small piece of plastic of the X axis broken, so I've to glue it. Apart from this, the hardware is working, at least what I can check without connecting it.


Because the missing parts I've decided to convert it to something else, something I don't still have. So a vinyl cutter.

First step is to build the electronic board. An Arduino Pro Mini with a ATmega328 can work for me.

The firmware I've selected it's grbl (https://github.com/grbl/grbl), but I've to compile a version that works with a servo as Z-axis, cause my holder will be based on a servo.

The pcb is simple, the grbl docs page contains all the information about wiring. I've to wire two stepper motor driver board, A4988 based, and just a straight wire for the servo conroller, which will be a mini RC servo.


I've assemble the PCB under the original PCB, reusing the USB and power plugs. That way I can use the original case holes for connections.

The motor of the plotter are 4 wires, just follow the grbl guidelines to wire it. Find the correct wiring diagram is just a matter of finding the stepper motor coild using a multimeter reading resistance between wires.

Now the holder mechanism. I've take the design from the following project https://www.instructables.com/CNC-Pen-Lift-1/. I've copied it and adapted to my needs.

I've buy a Roland plotter compatible cutter and adapt the holder for my cutter.

I'll use GRBL plotter (https://github.com/svenhb/GRBL-Plotter) as software.

I've covered the plate of the plotter with a plastic 4mm sheet, this will prevent the cutter blade to break on the original alluminum base.


Then I've to set the step steps/mm for each motor. There are plenity of pages teaching how to do this, so it's just a matter of reading and applying the procedure.
In my specific case I've set
$100 80.240
$101 80.240

Also I've to set in G-Code Generation tab of the GRBL plotter the Pen up / down translation to PWM, then set the PWM op Pen Up function to 1000 and Pen Down to 0.

One the plotter is set I've to select the proper spring for the holder. The holder spring defines the cut strength.

I've made some test. What I've found is that cutting vinyl is not so simple, the most difficult thing is to find the right cut spring. At the end of the day the cutting quality is acceptable to me. Not as accurate as a pro machine, but as much as I need, and also I've saved a plotter from the junk.

Notes

  • read risk disclaimer
  • excuse my bad english

Monday, June 12, 2023

Tap tempo delay guitar pedal by Fattoria Mendoza repair

A friend of mine give me his non-functional tap tempo delay guitar pedal.

The problem with this pedal was that one can hear an annoying clicking sound while playing. Also after trying it for a while it stops working.


The pedal is called La Macchina del Tempo by Fattoria Mendoza, a custom pedal builder here in italy.

Advice: I've never have any pedal from this company. I think the pedal I have has been handled by someone outside the company, or they have build this as a demo pedal, indeed I can not find this pedal on theire actual website. I advice you this cause what I've found in this pedal is not that beauty.

First time I've opened the pedal I've seen a little bit of a mess, wires has not been secured on the case.

I've played this pedal for an hour or so with the back case open. And after a while the pedal stop working, the output led does not blink.

The pedal itself has a couple of boards, the main one is a 1 side PCB with a scratched number, I've searched for it and I've found it's a kit uk-electronic named Kit Digital Delay PT-80 with tap tempo (http://uk-electronic.de/onlineshop/product_info.php?products_id=2326&language=en). The other  two are prototype boards that just has some capacitors and a output volume control.


First thing I've checked is the switching regulator, the LTC1044. And that's the guilty. No voltage output from this IC. So I try injecting voltage after it and the pedal start working again. So I've replaced it.

While waiting for the IC to be delivered I've clean up a little bit the PCB. I've soldered a couple of components that where just punched in used pin head. And resolder a couple of wires.

When the IC has been delivered I've checked the pedal, and here I can found the first problem my friend told me about, that it the annoying clicking noise.

I've notice this noise has exactly the same frequency of the tap tempo led. So I've remove the led and I've notice it was the led the root of the problem. Adding a capacitor on the supply line does not solve the issue. So I've added a RC low pass filter on the led line. This will slow down the led light up but has solved the issue.


Now the pedal has been cleaned up and can be used again.

Notes

  • read risk disclaimer
  • excuse my bad english



Saturday, May 6, 2023

Dual Terratec Phase 88 Rack audio interface repair

Terratec Phase 88 Rack is mid 2000 8 channel in/out audio interface. It has 8 balanced/unbalanced input, 2 of them phantom powered, and 8 balanced/unbalanced output. It can reacord at 96 kHz.

For more than 2 channel recording I'm actually using the ST Audio DSP2000 interface, running it on linux. You can find the full article here: http://davidegironi.blogspot.com/2017/11/st-audio-dsp2000-c-port-on-linux-using.html

Like the ST Audio, the Terratec also it's based on a Rack + PCI interface design. And you guess... the PCI is running the IC Ensemble Envy24 I/O controller chip too, nominally the ICE1712.

It happens to find a good deal for a couple of Terratec. To me it means to have 16 channels of recording power instead of 8. I don't really use that card to much, just to record drums, but that deal was so good I couldn't let it go.

Terratec Phase 88 Rack PCI Full specifications:

  • 8 balanced analog inputs, 1/4" jack
  • 8 balanced analog outputs, 1/4" jack
  • 8 gain controllers on the front for setting levels for analog inputs (20dB range)
  • 8 input signal and clipping LEDs on the front panel
  • 2 XLR/jack microphone inputs on the front panel as alternatives to the Line inputs 7 and 8, inputs 7 and 8 switchable between microphone and line/instrument levels, switchable 48 V phantom power for microphone inputs
  • 2 separate MIDI interfaces (5-pin DIN)
  • 24-bit/96 kHz A/D converter with 100 dB (A) SNR*, 100 dB(A) typical @ 48 kHz
  • 24-bit/96 kHz D/A converter with 110 dB (A) SNR*, 109 dB(A) typical @ 48 kHz
  • WordClock I/O
But the deal has a price... the supply is missing, and one of the card has channels 7 and 8 that does not work. Also, driver for Windows are a question mark, I can not find a sure answer if they work or not, but for me that was not a problem cause my first plane was to use linux as a recordind station.

The package has been delivered, I've opened it and connect both the PCI and the related rack to a Core 2 Quad 2 Q6600 with 8Gb of RAM, and 500Gb SSD I would like to use for this project. It's not the best PC for mixing but I will use it just for recording. It will suffice.

The rack needs a 12V AC 1.5A AC supply, I've one 3.5A the just fits both the rack.

To my surprise, the latest 5.51b driver from Terratec works on Windows 10 x64. I've configured one card as master, and the other as secondary, calibrate them throgh the driver mixer software, I've reboot... and they works. I can see cards input and output in Reaper using the ASIO driver from Terratec.


Now it's time to repair the channel 7 and 8 of one rack. That channels emit just a white noise, no matter if I try the line input or the mic input. I have to open the card and trace out the problem. Of course there is not schematic for this card, so I have to trace the signal using the continuity functionality of my multimeter. Signal goes straight from the inputs (line and mic) to a relay, that is driven by software, then to the LM833 op-amp. This is the first stage driver for the input. I take my multimeter out, feed a 100mV 500Hz sine in the line input and find out that for both the channels out from the first stage of the LM833 there's a DC signal that has nothing in common with the expected sine. So I've ordered a few LM833 and replaced the two of channels 7 and 8. Channels now works! For a few bucks now I've got a 16 channel recording station. As for my DSP 2000 ST-Audio station I will use it just for recording, this time I'm on Windows but even if the PC is not that powerfull it works fast if used just for this end.


I've also try the Terratec on Linux, but the Envy24 driver are not compatible with this specific hardware, I think one has to download the driver code, fix it and recompile the kernel, but to me just using Windows is enough.

Notes

  • read risk disclaimer
  • excuse my bad english

Monday, April 3, 2023

UNI-T UT61D AC mode repair

My first "pretty good" multimeter was a UNI-T UT61D.

Now it's discontinued and one can find a better one for a low price, but backin time it was a serious replacement for my 5 bucks cheap meter Main featuras are True RMS, 6000 count and autorange.

I still use it as second measurement/testing unit.

Last month I've notice it has a problem when using it in AC reading. As example trying to read 12V AC out from the sec of a transformer I get 3.3V, same reduced reading for my main supply, which in Italy is something around 230V.

First thing I've notice when I opened the meter it was a few components with some sign of corrosion, at least it seems to me that.

So simply resoldering three components solves the problem... but it did't last long. I thought the problem was related to cracked solder, but after a day the problem still exists.

I take to opportunity here to show you what's a genuine bodge high speed switching diode. When I opened the multimeter, I've noticed that the R9 does not seems a resistor. Indeed desoldering it, turns out that over the resistor someone in the farm soldered a high speed switching diode. It's marked C3, and I think it's a 1SS226, maybe to protect something, but I've not investigated further.


Back to the issue, as I told you I've not solved it by resoldering those three components. So I've to investigate. The meter it's based on Fortune Semiconductor FS9922. Although I can not find this meter schematic, I can find the FS9922 datasheet which is equiped with useful usage cases. I'm interested in the AC reading.

Turns out that datasheet show us how to connect the AD737 to FS9922. The AD737 is a True RMS to DC converter, and what's matter most it's the same IC used in by UNI-T in my meter.

I've resolder components around the AD737 and meter seems to works again, but it did't last long.

So, first of all I've hooked up cables to a few input and output of the AD737, to see if there's something wrong, but i did't catch anything.

I've thought it was the AD737, so I try replacing it. This is a long story too, I've buy a couple of AD737 from a seller, first time they sell me wrong IC. Ok, it may happens... they now ship me the right IC. At that point one month is passed cause it takes a few weeks for each shipping to be delivered. One the AD737 has beed delivered I've replaced it, but both does not works. So I've but two more, this time from a reputable seller. And this time replacing the AD737 makes the meter works again... but it did't last long. The first seller sends me fake IC. But even with the original one the meter does not work like it should.

To that point I though it was some components or the AD737, and I start thinking it was something related to heat, cause when I resolder things it works for a couple of hours.

I have made a post on the eevblog forum, and a user suggested me to look at the gain input stage of the AD737. I desoldered the resistors and checked it. Heating up and reading it.

Resistance does not differs that much when I heat that resistors.

Another thing I've notice is that just breathing on the back of the PCB a few times it's enough to make the PCB works for a few hours.

That turn on a light bulb for me... That must be something related to capacitors, cause the heat of the breath it's been dissipated in a few minutes, but the meter works for a few hours after that. So it must be something that chemically is renewed for hours just by a small amount of breath. And that should be an electrolitic.

So I've started investigation on the AD737 elecrolitics. I've first changed the one on the input signal, but it was not that one. So I changed the two of the power supply rails... and... it works! Even after a day it works.

That damn electrolitics cause the issue. 

I takes a long to repair this meter and for sure it will be simpler and cheaper to replace it, but it's my first meter, and also repairing this gives me the opportunity to gain my knowledge on electronics.

Notes

  • read risk disclaimer
  • excuse my bad english

Tuesday, March 7, 2023

Vintage Philips speakers restoration with TPA3118 bluetooth amplifier

A few month ago I've restored a vintage Philips RH591 amplifier from 70's. I've sold this amplifier but I've kept the speakers cause I liked it.

 

They have two 5 inch octagonal AD-5060/M8 midrange speaker each, and one 1 inch AD-0161/T8 tweeter.

First thing I've done was measuring the impedance. One of the speaker had a short circuit. So I decided to open both.


 Opening the two was not so simple. At Philips they have used some kind of glue for the backpanel, even if the backpanel has securing screws. That glue was also used to join the speaker to the case, although also there are screws.

Once opened I've noticed there was also a 2nd order low pass and high pass filter.

One of the tweeter was broken, so I had to change both. I've used two 90's Pioneer tweeter. They do not sound as clear as the AD-0161, but they perform quit good at all.

I had to draw and print a frame to connect the new tweeter to the case, it was a pretty simple piece.

Another thing I've drawn and printed is the bass reflex tube. They speaker were closed but they sound better with a bass reflex. I've drilled an hole on the back panel for the bass reflex.

I've used a simple one capacitor 1st order filter. I prefer to let the midrange speaker works also on high range, and then boost that range using the tweeter. I've found they sounds better with this configuration.

Just a few rework on the wood side and a clean of the front grill and the speaker were ready to be reassembled.


 I also would like to make the speaker active, possibly with a bluetooth amplifier board.

One of the speaker contains the power supply and the amplifier, the other it's a passive one.

I have an adjustable 4A 230V linear power supply, which I put in one of the speaker. I also put a power plug and a power switch. It's regulated to 20V.

I've buy a couple of boards based on the TPA3118 monolithic IC. One of the two (the blue one) has a little hissing noise on the bluetooth, but the other (the black one) sounds really good. The blue one also has a fake TPA3118, even the pins are not 32 but 28, so it may be TPA3110 or a fake one.

 

In order to move the audio jack mounted on the board, on the backpanel, I've desoldered the jack and find out that the jack tip to GND select the bluetooth input, otherwise the jack input is used by the preamplifier mounted on the amplifier board. So I've added a little DPDT switch to select the audio source for left and right channel, which can be bluetooth or line input from the jack.

For the second passive speaker connection I've used a GX12 screwing connector.


 Because the speker were mounted on the top of a bookshielf, I've added a power switch to the power cord, and I've left the switch activated on the speaker. that way I can power both on from the desk.

So, how they sounds? They are really loud and sounds more crystalline than I tought, the just a little bit low on the bass, not that they don't have but without any equalization I would have preferred a little more of basses.

Notes

  • read risk disclaimer
  • excuse my bad english

Wednesday, February 8, 2023

Open source .NET software license manager


DGLicenseLib is  .NET library you can use in your project to manage software licenses.

If you distribute your software and need a way to give your customer a personalized license number, this library can help you.

It's open source, and available as a package on nuget.

This library uses asymmetric cryptography to sign a license key. The license key is the verified by the client software to allow software usage.

DGLicenseLib uses an Elliptic Curve Digital Signature Algorithm (https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm) to sign the license, namely the secp256k1.

It's composed by three parts:

  • DGLicenseLib: the main license library that implements sign and verify function, it can also be used to generate new key pairs
  • DGLicenseLibDeviceId: this library it's used to generate "unique" id based on the PC hardware running the software
  • DGLicenseLibUC: this library contains a couple of UI helper that can be integrated in the client software to simplify the licensing
  • DGLicenseLibManager: this is the GUI application that helps you to manage your distribuited license

The idea behind this library is that you can develop your own interface, GUI, CLI, API... but there are a couple already deployed. This will save you time. So, all the function exposed above can be implemented by directly calling the DGLicenseLib, for the sake os semplicity I'll explain you by using the UI provided by the software.

First, you have to generate a license keypair using the application DGLicenseLibManager. Just give a name to your keypair, and click Generate. This will pack your keypair (private + public key) in one single file.


On client side, you have to include in your software the provided public key.

Another thing you can do, if you want to restrict your license to a PC, is generating an unique id for the PC which is running the software. This can be done in several way, the helper provided by the library DGLicenseLibDeviceId do this for you just by calling the method GetDeviceId.

This method will generate an unique device Id based one your hardware: 

  • Motherboard Serial Number
  • CPU identifier

Now just set a filename for your license file.

If you use the helper included in the DGLicenseLibUC library, you just can check you license by calling the method CheckLicenseFile.

This method will do the following for you:

  • load license from your license file (if one exists)
  • show a license helper UI that ask the user to fill a license key to activate the software

Of course you can set a null device id. This way the license provided can run on all the PC.

In just a few line of code you have secured your software, find an example below

string licensePublicKey = "-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEKKAzjD8Ln5dJagBqIVWImHJH4R4VTQ9A\nfSbdjk7B7pcwZFiBP6xCV7A4fpN1C7YmgtfJ5WdO+Sjwxq1S8pwM/A==\n-----END PUBLIC KEY-----";
string licenseDeviceId = DGLicenseLibDeviceId.GetDeviceId();
string licenseFilename = "license.lic";
Nullable<DGLicenseLib.License> license = null;
if (!DGLicenseLibClientHelper.CheckLicenseFile(licensePublicKey, licenseDeviceId, licenseFilename, out license))
   this.Close();

The user now has to request a license by sending you the license request. Which is the Base64 encoded value of  the public key and your device id.

You can now use the DGLicenseLibManager application to Sign a new license. When signing the license you can

  • set an expire date, if non is selected the license will not expire
  • set additional data

The license payload:

  • device id
  • expire date
  • additional data

is then signed and the payload and his sign are encoded in Base64 format.

This is the string you can give your customer.

The user now can insert this license key. The provided helper will check the key validity by using the public key of the software. It will also check for the device id provided and the expire date. If check passes the license file is written.

Next time the softare restar the license file will pass the check and the license form will now shows up.

Code is distributed with a sample client project "DGLicenseLibClientSample" you can take a look at.

The UI helper for client is also internationalizable by using json files or an extenal class loaded. Find and example in the sample client project.

Asymmetric signing code embedded in this project is taken from the library "A lightweight and fast ECDSA implementation" (https://github.com/starkbank/ecdsa-dotnet).

The device id generation code is indeed taken from the library "DeviceId" (https://github.com/MatthewKing/DeviceId).

You can consider this library as an helper package to develop you licensing solution for your software. But this will not have to give you a false sense of security. Indeed anything that is distributed as an application can be cracked. You can obfuscate and pack your software with open source or commercial software and libraries but an expert hacker can crack your system. You'd rather focus on making your customer happy, this will give you a change that your customer will not crack your software but pay you for that. And this library will help you developing a license solution with just a few lines.


Code, Binary & Packages


Notes
  • read risk disclaimer
  • excuse my bad english

Friday, January 6, 2023

AVR serial to 8 digits seven segment numeric display


The avr_serial7segment8bitdisplay is an ATmega8 based device that get's 8 digits numbers from the UART line and display to a seven segment display with 8 digits.

As example, it can be used as exchange rate display.


By default it can display positive (max 8 digits) and negative (max 9 digits) integer and double precision numbers.

The display driver used for the seven segment display is the MAX7219.

It can perform pad left of pad right justification.
Also it can load the last values recorded to the internal EEPROM.


The protocol used to send data to the device is simple, find below the format:
STX CRC dd n ETX
  • STX is 0x02
  • CRC 1 byte check code
  • dd (2 char numbers) is the display number 00..99
  • n (1 to 8 char numbers + optional . or first character minus) is the float digit, one dot, negative char and numbers allowed
  • ETX is 0x03
As you may notice it can handle up to 99 8 digits seven segment display.
A CRC 1 byte code is required to be sure that the data is received with success.
If the CRC code is checked successfully then the number is parsed, and eventually displayed and recorded in the internal EEPROM.


 Errors in getting data can be skipped or displayed by setting the desired behavior at compile time.

A PowerShell script (https://en.wikipedia.org/wiki/PowerShell) has been used to test this device. You can use this script to write your own or to send directly your data.

The sample board provided use 2 seven segment display.

The UART to USB interface chip is the CP2102. I've select this chip cause it works without problem over the main operating systems.

The power as the data are provided through a micro USB port. 

The ATmega8 runs @1Mhz using the internal LC oscillator.

I've also design a small 3D printable enclosure that I've printed using PLA.


 
Code and Schematics

Notes
  • read risk disclaimer
  • excuse my bad english