Software for XRF

(AI translated)

For several years now, Olympus has not been able to make decent software. Even the most elementary errors are still not fixed, and don’t even ask about the graphs. In my work, I sometimes need to compare the entire XRF spectrum—like comparing the “fingerprint” of a material. Not just compare but also highlight important zones, add markers, and, of course, print it nicely or export it to a PDF file. All the software was written in about five evenings and purely “for fun.” In the process, I learned a bit more about .NET capabilities.

To use the program, you need to somehow export the XRF spectrum to a CSV file. That doesn’t work immediately either, but you can overcome Olympus’s foolishness and somehow extract the data. Then you need to remove the first 40 rows and the first column (maybe I’ll make automatic import later).

A working example with three materials that are very similar. The “standard” graph seen in the original software looks something like this:

In the old version of the original software, which only runs on XP, there was a logarithmic scale. So we made a logarithmic scale:

You can see an anomaly at the silver. Knowing that these materials are declared as identical, it is clear that someone is slightly cheating. One material is very poor catalysts, the other material is the same catalysts but with burnt capacitors or some other catalysts added. Probably nothing malicious, but “non-standard” materials sometimes affect quantitative XRF analysis (compared to ICP) and all kinds of “bad things” start, like poor measurements or similar complaints. And when you “magically,” like Sherlock Holmes, say—dear sir, did you perhaps pour some “condensers” into the general barrel? Everything gets sorted out immediately.

Two materials—one is copper, the other is also copper. But apparently, a little bit of zinc got in from somewhere. And this is what the PDF file with the same report looks like: copper-non-copper.

And here is an illustration explaining why sometimes XRF shows nonsense:

This is pure, 100% gallium measured. Its XRF spectrum is marked with a marker. And what are these recurring nonsense on the right? A new unknown element. Nobel Prize! Unfortunately, these are just harmonics when analyzing a strong signal. And now let’s think about how complex the software that does quantitative analysis must be: it has to consider harmonics, the fact that some elements cover others, that the X-ray tube itself is made of some metals, that there is also “scatter” radiation, when X-rays of any level reflect and fool the detector, that some elements absorb X-rays, while some materials let primary rays penetrate deeper and then fully lock any reflections inside, but when a weaker radiation is released, everything works.

This was a bit about my current job, not really related to electronics, right? 🙂

The program itself and some demo CSV files (already prepared for work): XRF.

Posted in AI translated, Anything | Tagged | Leave a comment

Lack of PCIe lanes?

(AI translated, from 2022.02)

I have already written that I use many small disks. Together with the remaining large disks, it totals 10 disks. And I have always wanted to use some fancy RAID controller. However, no matter how many controllers I put into the spare PCIe (x8) slot, none of them worked, the computer didn’t even start BIOS

It’s a physical x16 slot, but it only has x8 lanes electrically. This is common in household computers – the first long slot is for the video card, x16, and the second is only x8.

The x8 isn’t a problem, as RAID, SAS, and SATA controllers were all x4 or x8. But all of them refused to work. Although, the second video card (x16) or even a dual network card (Intel® 82571EB 2x1Gb, x4) worked perfectly in this slot… The video card reported that it was working on x8. I didn’t ask the network card.

Even taking something as simple as a JMicron Technology Corp. JMB585 and plugging it into that slot, the computer doesn’t start. What’s the issue?

Although mechanically it’s an x4 slot, electrically it’s only x2. I haven’t seen x2 PCIe slots. Reading the chip’s datasheet, I came across the line ‘Supports up to two lanes of PCI Express’, which means it doesn’t necessarily have to be x2, x1 is also fine. My computer’s x1 slot doesn’t physically accept longer cards (and the ID line on this card isn’t connected to x1), but trying to connect through a PCIe riser, everything magically works:

Indeed, the other end is plugged into a free x1 slot.

Now the question. Why don’t the directly connected cards work? Too few free PCIe lanes? Misconnected ID lines on the cards or the motherboard? What’s the issue? And will this SATA-PCIe ‘bridge’ work if I mechanically cut the PCIe slot and connect the ID contact?

If anyone comments that the disk speed will be very low, my answer is – I know, those disks are only used for background backup copying.

2024 EDIT. All the problems were from shitty mainboard. Using new, i7-14K based system everything is OK. Simple, the system was to old for my experiments.

Posted in AI translated, Anything | Tagged | Leave a comment

Mental Exercise: SVG Language Interpreter

(AI translated)

It all starts with a small nonsense: I decided to put a USB port logo on a 3D printed product. I couldn’t quickly find any STL file (for free or download without registration). So I thought to myself—well, there’s an SVG illustration, it’s a pure vector, I just need to “extrude” it upwards and everything will be great.

And then it started… My 3D printing and modeling program doesn’t accept such files. Well, it’s imperfect and not intended for that. The online converter also didn’t work:

We see how it cut off a piece from the square.

This requires something more serious: CorelDRAW, AutoCAD… I’m more familiar with Corel, so I open that SVG in Corel What a mess! Firefox or some Chrome handles the file perfectly! You can try it yourself.

Well, the SVG file is essentially a text file with various graphic commands crammed into XML. With Notepad, I edited the file a bit and got a slightly corrected version of the SVG

Now the image is correct (I removed the white background along the way).

We export it to DWG/DFX, open AutoCAD to make it 3D and get frustrated:

What the hell? Why so few points? Where are the curves?

And then the “horses” started running away with me (“Меня понесло”). I completely forgot the initial task and decided to write the converter myself… First, I decided to understand how the pure unpacked SVG works, i.e., I decided to write an SVG language interpreter. Although they say the file format was created by W3C around 1999, I feel that its foundations come from the 1960s, when some pioneer, like HP or Xerox, was creating mathematical models for vector description.

Thus, a new project was born that no one needed. However, it was a very serious exercise for the brain:

The program is divided into several parts:

  • Windows printing/drawing/control
  • Text file preprocessor – the program removes all abbreviations, compressions (e.g., not writing zero) and converts it into “canonical form.”
  • SVG language interpreter – the program takes one command, collects parameters, calculates coordinates.
  • Geometry and trigonometry module which calculates and draws graphics. (this module is partly from the internet, there is a URL source code)

The program can print the result to a printer or pdf. That list next to the picture is the preprocessor-interpreted initial code:

M481.114 37.464l16.415-28.96 16.834 28.751-12.164.077-.174 70.181c.988-.552 2.027-1.09 3.096-1.643 6.932-3.586 15.674-8.11 15.998-28.05h-8.533V53.251h24.568V77.82h-7.611c-.334 25.049-11.627 30.892-20.572 35.519-3.232 1.672-6.012 3.111-6.975 5.68l-.09 36.683a14.503 14.503 0 0 1 10.68 14.02 14.5 14.5 0 0 1-14.533 14.532 14.5 14.5 0 0 1-14.533-14.532 14.504 14.504 0 0 1 9.454-13.628l.057-22.801c-2.873-1.613-5.62-2.704-8.139-3.705-11.142-4.43-18.705-7.441-18.857-33.4a14.381 14.381 0 0 1-10.43-13.869c0-7.946 6.482-14.428 14.428-14.428 7.946 0 14.428 6.482 14.428 14.428 0 6.488-4.21 11.889-10.004 13.74.116 20.396 5.54 22.557 13.528 25.732 1.61.641 3.303 1.312 5.069 2.114l.214-86.517-12.154.076z

I extracted this code from the initial SVG file. The same one that Corel couldn’t read… By the way, my software tries to interpret all commands. Unfortunately, there wasn’t time to debug everything. For example, I don’t know the difference between a “quadratic Bézier” curve and a “smooth quadratic Bézier” curve.

So I wrote cooler code than the Corel Draw programmers…

And I’m not at all sorry: SVG interpreter VB.NET source code and compiled exe and setup.exe. This is a working version with its bugs. I don’t know if there will ever be a newer version.

How do you like Levo’s mental exercise? There will be no continuation because my quasi-Covid ended and I will have to go to work again and there will be no time to play. This project took 3 evenings, including writing this article.

P.S. The initial SVG is not optimal. I could manually write a shorter (fewer commands) and the image would be the same. And who needs such “precise” numbers?

P.S.2 My preprocessed SVG interpreter worked perfectly with the online SVG2STL converter: USB LOGO STL. As the initial result was achieved. Whether it’s worth converting to STL or AMF, I don’t know anymore. 🙂

Posted in AI translated, Anything | Tagged | Leave a comment

XRF repair

(AI translated)

Continuing while still feeling under the weather (symptoms suggest COVID, but PCR says no), I took another look at the old XRF. I have already somewhat explained how it works and mentioned that the “black fin” isn’t trying to read the firmware from the SPI ROM. However, the oscillator is outputting its 16MHz. Let’s start examining the schematic:

  • A-part: This is the MCU core voltage regulator. Seems to be 1.2V. It works. Generation is visible on the MOSFET, and the voltage on the large tantalum capacitor is normal.
  • C-part: The 16MHz oscillator works.
  • D-part: RS232 converter. Signals pass through in at least one direction.
  • B-part: What is this? It’s a CDCV304 200-MHz General-Purpose Clock Buffer. It’s unclear why it’s here. The first pin is static, meaning the outputs will be empty.

Let’s remove some components as traces run underneath them:

We see that the trace from the oscillator’s pin (out) goes directly to the buffer’s first pin (in). However, the signal doesn’t pass through. The contacts are fully isolated. Upon zooming in, it’s clear that there’s no trace at the “C” contact. Now, a rant and question: if PCB technology allows for thin traces, it doesn’t mean those traces need to be so thin. The oscillator is quite massive, the device is handheld, there might be thermal expansions involved… And there’s definitely plenty of space. I clearly remember that this type of failure (where the connection between the handheld and the device was lost) occurred in several devices of that generation. They repaired it by replacing the “motherboard” at the factory…

My hands are a bit shaky:

We connect the necessary contacts with Mylar wire and suddenly, data flows from the SPI chip and dynamic signals appear at the test points.

Even partially connected, everything magically starts working and the device calibrates (standardization). Now the problem is to gather all the case elements and screws since I scattered them on the table and around the room, not really believing the repair would be completed. And I also need to find a new battery for the handheld, as the current one (already rebuilt once) no longer holds a charge at all.

Posted in AI translated, FPGA, MCU, Vandalising | Tagged , , , | Leave a comment

They forbid plastic straws…

(AI translated)

I’ve caught a bit of a cold (probably not Omicron), so I’m as angry as a hornet. Everything irritates me quickly. To vent my anger, I’ll rant a bit. I’m fed up with humanities people – ecologists. I can’t stand them. Let’s save nature, ban plastic straws. Not make plastic “biodegradable” like various plastic bags, but ban it altogether. And at the same time, a few years ago, all the humanities people said how great a thing the spinner is, how it helps autistic children (and hipsters)… By the way, on Friday, I showed a spinner to a young aunt, and she didn’t understand what it was… So let’s look at a specific model:

It supposedly helps with something, a super tool and so on. Now let’s look deeper. First, the packaging – good, it’s paper. It can be recycled or burned. The body – plastic. It can be melted down into flower pots or speed bumps.

And this:

This spinner once glowed with colorful LEDs… Each spinner has one bearing (iron can be recycled) and THREE! PCBs with batteries.

Yes, take those batteries and shove them up some ecologist’s ass.

Posted in AI translated, Personal | Tagged | Leave a comment

XRF analyser

Unfortunately, January was completely empty. A bit of fiddling here, a bit of fiddling there. Some FPGA experiments with soft processors, some uninteresting repairs, some computers, and some programming. Nothing that could really interest readers. Maybe this unfinished repair will be a bit more interesting:

Innov-x alpha a-2000 There is this old device, a handheld X-ray fluorescence spectrometer. It is one of the oldest models – Innov-X systems inc, alpha-2000A (α-2000). From the times when this company existed. Now it’s a part of Olympus. Back then, the device cost a fortune, though, to be honest, new XRFs also cost quite a lot. The principle of operation is that a weak X-ray beam reflects off the material being analyzed. These soft X-rays are detected and their energy measured. From there, it’s purely statistics based on KeV…

Innov-x alpha a-2000 All calculations are done on an HP handheld. Since each detector is unique, without the appropriate calibration software, these devices don’t show anything useful. And this particular device does not communicate with the handheld.

Innov-x alpha a-2000 Inside, it’s pure old-school. Two boards – power supply, temperature stabilization. And some DSP or CPU that probably collects the initial spectral data. All communication between the DSP/MCU and the handheld occurs via RS232.

There are unexpected solutions on the board 🙂

Here is the high-voltage source for the X-ray tube.

I don’t know the exact parameters of this model, but new XRFs can have up to 50kV and 0.2mA. That’s a maximum of 10W of electrical X-ray power… It’s evident that the device experienced over 50G, as indicated by the red marker. Maybe it’s a bit incorrect to call it a power supply since it’s an unserviceable module called a “Moxtek Analog X-ray Source,” not visible in my photo, but a small X-ray tube is connected to this box. It’s better seen on the manufacturer’s website. The number of this module aroused my curiosity – if the analogy holds, it’s a 60kV X-ray module.

The photo enlarges.

The signal from the handheld goes to the right PCB and the right side of the PCB (TP11, TP21), then goes to the flat cable, on the other board it’s TP27, TP28 and goes to the ADM3202A chip. On the TP contacts, one of the RS232 signals is visible, the other is completely dead. Either the DSP or CPU is dead, then the device is thrown away, or the RS232 signal shaper is dead. Which is more logical since it has contact with the outside and something might have shorted there. So it lies on the table… By the way, I have another alpha that works, just shows inaccurate readings… And one delta that works only when kept in the fridge – the detector’s Peltier cooler is not working well anymore. None of these devices are repairable at the factory anymore, now they only make Vantos… These are left for experiments, unfortunately, they cannot be sold – Lithuanian laws do not allow it.

The repair of the device is described in another article.

Posted in Anything | Leave a comment

Windows ghosts devices

(AI translated)

If you happen to be involved in USB device design and frequently connect unsuccessful experiments, Windows secretly accumulates unnecessary information. Later, when connecting a “Generic” printer, there’s an issue – it’s unclear which port works:

Ghosts Only one of them is real. All the others are remnants from improperly programmed devices. However, Windows itself somehow does not allow these ports to be removed. Other ports can be removed, but these are blocked.

Even if you mark to show “hidden” devices in “Device Manager,” so many ports are not visible.

But there’s a trick:

Ghosts Here, an additional system variable is recorded. Then “Device Manager” starts showing all the “ghosts.” The variable is called “devmgr_show_nonpresent_devices.”

Ghosts The picture is rotated because it turns out too long.

Now you can gradually start uninstalling them. Unfortunately, you can’t delete them in bulk.

Posted in AI translated, Anything | Tagged | Leave a comment

2022 is here!

(AI translated)

Well, it’s New Year again. Probably, 2022 in a row since some event. Or 5782. Or 1443. Or Reiwa 4. Or maybe 7530? Or maybe 4720. For me, it’s probably about the 50th number…

So, the number doesn’t matter. What matters is that the days are getting longer. And on this occasion, you can wish something for yourself and others and make promises. Like that there will be no mess on the table… 2022 New Year … or it will be even bigger.

So I wish that the mess on the table does not bother you at all, that ideas are generated non-stop, that the hobby brings good mood, that everything goes more fun and successfully. I wish everyone happiness, health, and love in the upcoming numbered year.

Posted in AI translated, Anything, Personal | Tagged , , , | Leave a comment

My Disk and Data

(AI translated)

Yesterday, I wanted to open an old file and pfff…. A quick analysis showed that the disk is dying, although SMART says everything is fine. Shit. But it’s a good opportunity to talk about how my disk farm is organized. I have already written that my home computer’s disks are gradually migrating to smaller ones. The disk that just arrived was large (in every sense), but now it will migrate to smaller ones.

Mechanically, it’s a basket from some server. It was designed for SAS disks but is mechanically and electrically compatible with regular SATA disks. I just had to re-solder the cable to connect it not to the SAS RAID controller but to a regular SATA controller. Disk #1 is the system disk, a Samsung SSD. Disks #2, #3, and #4 are Disk X, a simple stripe RAID for temporary files (where standard TMP/TEMP and various programs’ SCRATCH files fall). Disk #5 with the 500 sticker is the new ‘My Documents’ disk. Disk #8 is not inserted.

The whole chaos looks like this:

There are also the old ‘My Docs,’ ‘Media,’ and ‘Backup’ disks. They are currently of large format. The ‘Steam’ games disk was removed because document copying was being done at the time of the picture. And disk ‘J’ is a backup disk connected via USB – I was looking for a copy of the corrupted file. The ‘Backup’ disk is intended for Windows’ own backup. However, it is almost useless. I constantly find that the backup did not happen or something similar.

Here’s how the floppy collection looks. I liked the basket’s mechanics, so I collected handles. And where do the disks come from? Well, when you change the working laptop disks to SSDs, you format the disks and use them. And they got collected from somewhere. That’s why they are so small – old and ‘working’.

Posted in AI translated, Anything, Personal | Tagged | Leave a comment

Ultra expensive keyboard

(AI translated)

Those who have traveled by air will probably recognize these keyboards. This is an industrial-level keyboard with ‘cherry’ keys and add-ons.

This also shows that Windows was very happy when I connected it to the computer.

This is a multi-device: keyboard, mouse, magnetic card reader (4 tracks), optical scanner (reads and OCRs text from personal documents where many ‘<<‘ symbols are printed). Also, there is a USB to RS232 conversion and, in this particular model, an ultra-slow and limited USB hub.

The keyboard is old, so the electronics are somewhat archaic. And its software is completely tragic. Theoretically, everything is connected as serial ports (mouse and keyboard – HID). However, it uses special drivers, so neither the OCR nor the card printer appear as standard devices. Special drivers and special software convert the information to another virtual COM port. Then, you can read information from cards or OCR. The information is contaminated with ‘service’ data and is not convenient to use. A similar problem occurs with 2D scanners from the same source – they are not usable in the household without serious hacking.

The optical ‘eye’ that reads documents. It also has LED lighting.

Unfortunately, such a detector only reads images. You won’t collect many pixels here.

The magnetic head with 4 tracks. It read all the magnetic cards I had, from payment cards to Maxima discount cards. My ‘Ačiū’ card reads very poorly in the store itself. However, the problem is definitely not in the card, because this keyboard read the data perfectly no matter how I swiped – quickly, slowly, or in any direction. I think the readers in Maxima are clogged and worn out.

I liked the USB hub, which, although very slow, allowed me to connect a mouse to the keys. This keyboard had a broken key, so when I took it apart, I broke everything. And unnecessarily, other keyboards do not have a USB hub. They are somewhat newer and simplified:

You can see that the place for the USB connections is prepared, but not filled.

The button itself:

This is a full-fledged mechanical button and diode. The diode is used due to key chords – it protects against ‘ghosting,’ when pressing several keys simultaneously, some combinations cause unstressed keys to be transmitted. The diode isolates individual keys. I don’t know how this problem is solved in membrane keyboards.

Posted in AI translated, Vandalising | Tagged | Leave a comment