Electric car battery dashboard gauge

I’m a happy user of a Citroën C-Zero. A small electric car, and when it was still produced, one of the lowest power consumption per kilometer. This model was build by Mistubishi and branded by Citroën and Peugeot in EU.

By searching on different forums, in particular myimiev.com, I was amazed by people able to find how to interpret the CAN-bus data in order to get the individual lithium cells voltages of the battery. There are several android applications able to access OBD2 data as well. So the source code of OBDZero gives a lot of insights.

Let’s take an Arduino based on a ATmega32u4, a CAN-bus board based on a MCP2515, and an OLED screen based on SSD1305. For the software I used plateformIO for Arduino, where the libraries for the screen and MCP2515 are easy to use. Wiring diagram and details below.

Information on the screen are
– The instant power delivered from / or received / by the battery, and a short history
– A chart representing the 80 battery cell voltages, minimum and maximum
– The state of charge in percent.

I used again Fusion360 to design a case for the gauge, I iterated from the Absurd Notifier design. I used PETG for the enclosure, PLA cannot sustain the heat when the car is on sun light.

Below a video of the project build and test. Code and 3D sources are here: https://github.com/pierre-muth/c-zero_dashboard

I’m not sure I will leave this project in that state. The refresh rate of the data from the CAN bus plus the drawing on the screen seems to push the arduino to the limit. Some data are skipped, so I might try with an ESP32 in a future iteration.

Details

I took the 12v from the car radio, such as the power is cut when the key is removed. At the opposite the 12V present on the OBDII plug is always there and I don’t what to drain out all the 12V battery.

The radio block can be removed just by pulling it.

From there it is quite easy to reach the ODBII plug, where only the 2 CAN lines are wired

Schematics:

Creative Commons License

The Absurd Notifier

It is the story of repurposing a broken Garmin watch into a desktop notification display. When focused on a computer task, don’t miss any notifications thanks to the absurdity of a desktop notifier.

Some time ago I struggle to make a small device displaying the phone notifications on a nice display. I tried with an ESP32 linked via Bluetooth to a custom app on my android phone. For example Mitchell Wong Ho made a nice project doing exactly that [link]. Unfortunately I didn’t manage to get reliable automatic re-connection after I got away with my phone.

Garmin makes very nice smart watches. And their phone application is full of features. You can have all the notifications you want on the watch’s display, and the connection is reliable. After detour from eBay, and I found a small Garmin vivosmart3 watch. The display is broken, but seems to still connect to a phone. And more importantly, it was very few euros.

The display of this watch is a monochrome OLED, 128×64 pixels. And here some of you might start to think of having a look on the data. To understand the data sent to the screen, I had to made a break-out board for the small smt connector. It was easy then to connect a logic analyzer. It is a SPI connection, so I started to program a PIC18F57K42 to forward the bytes to a serial port. Playing with some offsets reveals the image.

I have laying around some nice 128×64 VFD display I used for the Thermal printer project. Their connection is serial at 115200 bauds. So I programmed the PIC to act as slave SPI and Serial master, and put in form the data.

The display module is quite large, so I draw a case that looks like a 70’s TV set.

Remains 3D printing and stuff everything inside :

3D files and PIC program can be found here.

Thanks for reading!

Creative Commons License

Night reading 4K monochrome LCD display

I had a spare transparent monochrome LCD from the darkroom print project. It’s been quite a long time I’d like to use it to make a monochrome reading display.

I recycled an old laptop display backlight, and exchanged the LEDs by orange ones. Even warm white LEDs have a blue component on their light spectrum (left). I choose bright orange LEDs with a more narrow spectrum (right, Topled KY DELPS1.22-UGVI-36-J3S5).

I Printed a stand with room for the hdmi input board.

Pixel density is rather high, but with the right and large font settings, the texts are sharp and pleasant to read.

Creative Commons License

A 50 years old electronic calculator

This is a short story about fixing a 1970 Toshiba electronic calculator. It started with some attempts to find small nixie tubes such as the NEC LD-955A. It appears they were used in early consumer electronic calculator in the late 60’s. I found this faulty calculator, and only just for the 16 tubes it was a reasonable price. Once I got it, I thought it would be more fun to try fixing it.

The Toshiba BC-1625 is a 16 digits electronic calculator, Nixie display, two memories, square root and percent functions. You can also choose the rounding method and how many digits you’d like after the coma.

If you type “Toshiba BC-1625” in your lovely search engine, you’ll get several online calculator museum website. Which I happily discovered the existence. Eventually, you’ll find this website giving plenty of hints about similar model, and most incredibly you will find the work of Brent Hilpert. Brent worked on fixing a Toshiba BC-1212, and it is amazing. He reversed engineered the calculator, from schematics up to the algorithm itself and wrote down everything. While it is not the same model – 12 digits instead of 16 – the electronic is quite similar. Brent’s work was immensely precious, I’m not sure I could fix mine without it.

Opening it shows that several things was done before. In particular a weird rewiring of the main transformer. I unplugged the circuit boards before testing anything. If I put the input voltage selector to ~240V, the transformer works, but get hot quickly. After some trial to find the right ratio for a ~240V mains, I hard cabled it and bypassed the input voltage switch.

The logic levels are completely new to me, 0v for ‘true’ and -24v as ‘false’. Most of the logic gates, OR and AND are made of discrete diodes and resistors. Dozens of them. The integrated circuits are mostly flip-flops, and a pair of shift register, all in TO-101 packages. Which appears to be MOS technology circuits seems only used in Japan.

The typical fault describe by Brent is the failure of DC blocking capacitors. Once failed, these capacitors short the 180V directly, destroying the upstream integrated circuits. Most of the PNP transistor and some diodes driving the Nixies died as well. I started by replacing the capacitor, transistors and diodes.

In the meantime, powering the logic boards alone shows that not all the signals are correct. The oscillator and timings work, but not the ring counter used to cycle through the digits. Brent was right, the flip-flops failed due to the short of the bad capacitors. Luckily I could find these rare TM4103M flip-flops on Ebay.

With everything in place, the calculator is back in operation ! See few tests in the video below. Thanks for reading !

https://youtu.be/u2HSb11rnug

Creative Commons License

A cute little single tube Nixie clock.

We are back to glowing neon plasma, with yet another clock. The aim is to make some presents to offer to the family, for the end of the year. I previously made a little 6 tubes clock, that was inspired by Dalibor’s Zen clock. Here I want to mimic his amazing single tube Bulb clock.

Tube choice

The smallest tube I have is a NEC LD-8007 (right), which I used for the 6 tube clock. However I’d rather keep it as a spare. I also have some LD-955a (center) and IN-16 (left), it is a good opportunity to use them.

Design constraints

In order to keep as much as possible the ratio of the original Bulb clock, the electronic board has to be rather compact.

For convenience, the power should come from a standard USB plug. I could use the same type of small high voltage power supply from NeonPixels. It is compact and a single digit does only require 1 to 2 mA. However we need to reach at least 170 Volts, so the components should be resized accordingly. Plus, I’d like to have a voltage measurement, with a cut-off threshold in order to not burn the components.

To keep track of the time, Real Time Clock [RTC] chips such as the DS3231 comes in handy boards with integrated back-up battery. So let’s use them directly.

The selection of the digit to light-up, or in other words the cathode to be grounded, can be achieved by using individual transistors. We will gain flexibility on the component placement compare to larger integrated circuits.

The micro-controller should then have sufficient IO to:

  • Drive the high voltage step-up power supply.
  • Acquire the output voltage and cut the HV drive if greater than 200V.
  • Have two input for control buttons.
  • Drive the 10 cathode transistors plus a decimal point.
  • connect to the I2C port of the RTC.

After some cross check between Microchip PIC parametric search and the chips availability during this 2021 global shortage period, I decided to go with the PIC16F18346. It has just the right number of IO, and comes in a small 20 pins QFN package.

Making

After some tests on a proto board, it appears we can easily reach 200 Volts at few milliamperes. I selected a 10uH coil, ES1D fast diode and BSS87 mosfet. The switching frequency is 100KHz at 20% duty cycle.

Below on the left is the output voltage. It starts with the ramp-up until it reaches the striking voltage of 170V, then it stabilize at the sustain voltage of 130V.

The next step now is to start Kicad and draw the schematics:

The PCB was quite fun to draw. I started with a 4 layers design, not sure I could do it with 2 layers. I payed attention to isolate the high voltage parts and have large power tracks. Even if it will be hidden, I tried to keep the top layer ‘aesthetic’.

I ordered the board on OSHPark (oshpark.com/shared_projects/WM4Mp7db) and JLCPCB. JLC is really fast, literally 7 days between the file upload and the mailbox delivery, plus the boards are completely cut. While OSHpark is slower and board cuts need sanding, they have a really better silkscreen.

I draw the enclosure with Fusion360, and printed with a Prusa i3 MK3. It is a rather simple design and the board is hold in place by a circular clip.

Coding is done with MPLAB, and Code Composer is really convenient to setup all the peripherals. I have the high voltage power supply switching at 100KHz done by one PWM, another PWM at 500Hz for the brightness control, and a comparator measuring the high voltage versus a fix threshold. All of these going to an AND gate and drive the Mosfet. In addition I have the I2C peripheral for the RTC chip and a timer for the button features.

One button increases the hours with short press and increases the brightness with a long press. The second button does the same with the minutes and decreases the brightness with a long press.

About efficiency, of course this type of high voltage power supply is not the best. However, considering the small amount of power, it is not so bad.

When a digit is on at full (continuous) brightness, the current on the USB 5v is 61mA. Considering the current through the nixie tube is 1.25mA, the overall efficiency is around 60%. I think the large ground plane helps with the thermal dissipation, and the temperature of the coil stays below 30 degrees Celcius. Not to mention the digits are not lit continuously, there is dead time in the animation, where the switching is off.

Results

Sources and drawings are all available here : github.com/pierre-muth/solo-nixie

Creative Commons License

Flipping dots … gently

The ultimate goal of the flipdot project presented in the previous post was to flip each discs in a controlled manner. I secretly hopped to control the position of the discs by applying a pulse width modulated signal – maybe like micro-stepping for a stepping motor. And then control at which speed the discs are flipping. I could then make a quiet display at the expense of speed, avoiding the clicking noise.

However, these dots are well engineered and the discs have two stable positions. The behavior in between, is unpredictable and different for each dots.

The positive outcome of making a custom driving system is a fast refresh-rate matrix display. But I didn’t give up the idea of a slow moving flip-dot display.

Here comes a rather dirty solution. Put everything in a fluid with a higher viscosity than air. It should have high insulation properties and be fully transparent. I choose mineral oil (called vaseline oil in French) as it is cheap and non toxic.

The display is connected to the SPI port of an ESP32, which is getting the time via WiFi.

See the result below !

Creative Commons License

Flipping Dots Fast.

Some time ago, I repurposed a bus flipdot display. From then I kept an interest on this fascinating mechanical way of displaying information. Some companies such as AlfaZeta or Breakfast continue to produce them. They managed to drive them very fast, making animation possible. Usually, and it was the case for my bus display, all the dots of a matrix are driven sequentially. It is very common that each columns of a dots matrix are flipped one after the other, and for good reasons. Information on these matrices are meant to be rather static, and doing so requires electronics only for each rows and columns, and not every pixel.

If you saw my previous post about the Neon pixels, you probably see some similarly.

Gigantic modern fast flipdot matrices are truly impressive (and very expensive), notably here : https://youtu.be/SJU2-1X8kHQ and here https://youtu.be/VFG1D7lVMiY. There is a nice article on Hackaday. However one can see the driving process.

Some 8×8 squares or larger structures are notably driven separately, giving some artifacts when the animation is fast.

How these matrices are driven ?

There are tiny magnets hidden inside each flat dots. Basically, to flip a dot, you have to flow an electrical current into the coil, generating a magnetic field around it. The direction this current flows will flip the dot from one position to the other. Only a short pulse of current is needed. The electromagnet core stays polarized, keeping the dot on position, even when the power is gone.

Image courtesy eldisrl.com

The common solution to the problem of flowing a current pulse in both directions is using a kind of H-bridge topology. Add two diodes and you can multiplex the dots in a row/column way.

Frederic L made a very extensive explanation of how this works on his hackaday.io project.

And Yann Guidon started as well a Hackday.io project call Dot Flippers, aiming discussions and exchange about using flip dots.

How can we imagine a different way. My aim from here is to drive all the dots of a matrix at once, possibly up to 30 times per second.

Obviously, a driving mechanism should be implemented for each dot. There is some integrated H-bridge chip, but they are quite expensive if you consider one per dot.

After playing a bit with raw flipdots, I observed that a charged capacitor of around 10uF at 16V, discharged directly into the dot’s coil, is enough energy to make the dot flipping correctly. There is something to dig here, so I made a circuit with the coil in series with a capacitor, as shown below. One side is grounded. If you apply a voltage on the other side, the capacitor will charge, with a current flowing through the coil in one direction. If you discharge the capacitor by grounding this same side, the current will flow the other way.

Now how to charge and discharge this circuit? With a CMOS, or complementary Mosfet for example. (Or half H-Bridge…) Lets try to simulate this concept in LTspice:

It seems to work, the green line is the current across the coil. Pulses in both directions are generated, depending on which input is enabled.

A nice feature of this circuit is only the charge will consume energy, the flip back is for free.

We can buy flipdots here on Hannio.org. They come in rows of 7 dots, probably because of 7×5 fonts.

Lets start KiCad and prototype this idea. We need 7 drivers, a microcontroller and a voltage regulator. I Choose a PIC with a handy SPI peripheral, plus two 8bit port. The PIC16F15345.

Using a 4 layer PCB, I manage to fit everything within the flipdot footprint.

I ordered the boards from JLCPCB. As usual, I’m very satisfied. The price for 4 layers boards are very attractive, the quality is very nice, and they are in the mailbox in one week.

Now lets try assemble and make a test program.

The only problem I had is some transient negative pulse appearing when I unplug the main power rail. This kills the cheap 5v regulator I first used. With a free-wheel diode connected on the main 24V power supply (it should be max 20V as pointed in the comment! thanks Ken536) and a more robust voltage regulator (MIC5233-5.0YM5-TR), it seems we can proceed with the assembly!

Meanwhile, few purple boards arrived from OSHpark as well. Quality is top notch as usual, the silkscreen is amazingly precise. However the board sides have to be sanded to remove the supports. Too bad the ‘after dark’ option is not available for 4 layers.

The second Covid-19 lock down, and curfew here in France, gave me some time to solder the 2500 components and program the 48 PIC. I have to admit, having a task where you can focus and with an objective, helped me not going crazy during winter.

Communication is SPI, and all modules are daisy chained exactly as the Neon Pixel modules. However I had to feed the 20V at each ends of the boards stack, apparently the impedance of 48 boards in series is too much and prevent the dots to flip correctly at the end of the stack.

To test this 14×24 matrix, an ESP32 act as a socket server over WiFi and sends the frames on the matrix SPI input. A Java program captures and generate a video flux on a distant computer.

To conclude, I’m quite happy the resulting matrix is so responsive. And I have yet an other adventure planed for this matrix.

All the sources and schematics are on the following github repository : https://github.com/pierre-muth/fast-flipdot .

A small addition to people willing to reproduce this project: calculate the gran total in cost and time. Unless you’d like to experiment this driving strategy, it is probably wise to buy a professional product from AflaZeta.

Creative Commons License

Neon Pixels

IMG_7393

INS-1 / ИНC-1

Fortunately, these single dot tubes are still easy to find in large quantity and rather cheap. Made by Gazotron, it seems they buildup a large stock at that time. The INS-1 has the advantage to be small and produce a nice dot due to the lens-style front. Plus its striking voltage is maximum 100V, lower than regular Nixies.

Proto_SCHAt first I imagined 5×7 dot character modules, such as the TIL305, but bigger. While playing and trying to make a tiny and simple 5V to 100V step-up power supply, I realized how simple it can be. Here we just need to reach the striking voltage and only 0.5mA. As there is yet non uniformity in brightness between tubes, no strong voltage accuracy is needed. Without the signal generator, it is a diode and a coil, shorted to ground with a transistor at high frequency.

Then comes the idea to mimic the popular serial cascading LEDs, such as the WS2812 or SK6812, the so called Adafruit ‘NeoPixel’.

Neon Pixel

What I observed when I was empirically select the components is one key parameter to reach 100V is low resistance coil and mosfet. The voltage can be adjusted by choosing the pulse frequency and width.

IMG_20200706_103154

I was happy to see that only few pulses are needed to reach 100V. This enables pwm for bulb brightness control directly by driving the transistor. It is achieved with a pulse frequency of 100KHz and a PWM of 500Hz.

This leads me to the microcontroller choice. The peripherals needed are SPI, PWM, Timer, NCO and logic cell. The cheapest with all these options seems to be the PIC16F15313.

pic16f15313

I first have issues with the SPI daily chain propagation delays. The data takes some time to be clocked out from input to output. If we use the same clock line for all the devices, the data will quickly be out of phase in respect to the clock.

A workaround is to delay the clock as well on each devices, and have in one side a data and clock in signal, and on the other side a data and clock out signal. Fortunately, this PIC has 4 logic cells, so I can use one to delay the clock, like a line buffer. I was lucky that the logic cell delay is almost the same as the SPI logic.

The only problem remaining is the rise and fall edge detection, they are apparently slightly different. It results a kind of clock pulse stretching, a change on the duty-cycle. However I can deal with it. With a clock speed of 480KHz, the 384th device is still receiving a usable clock signal. 

Now that the prototype works, it is time for a PCB. The aim here is of course to have the smallest footprint, while keep connections at the opposite of the bulb.

I ordered the boards from OSHpark and JLCPCB. Both make very nice boards. OSHPark has the gold finish, and JLCPCB has the V-cut option, which is very convenient in my case.

Lets start the long journey of soldering, The 2020 lock down gave me plenty of time to solder the 384 boards, on which there is 11 components.

A matrix

Meanwhile, it is time to think about a usable display. I then made matrix blocks of 8×8 pixels.

And controlled by an ESP32. I got the first encouraging result.

IMG_7304

I start to make a support as well. A simple aluminium plate with two 3D printed legs. I add several slots in order to choose the inclination. 

 

Coding

I’m using an ESP32, with the arduino framework, and the Platform.io IDE. The nice thing is I could extends the AdafruitGFX lib. So all the work of drawing, fonts etc, is yet done.

I added the notions of display size and buffer size. With a bigger buffer size, I can make easy scrolling by changing the coordinate of the view frame.

This Github repository contains the code and the schematics/PCB. 

Coupled with Andy Geppert Core Memory kit:

Conclusion

With around 20mA per pixel, at full brightness, the total of the 384 pixels is almost 8A. Everything is at 5V, so around 40 Watts is needed when all pixels fully on. Everything then is powered by a 10A 5V power supply. 

This is the reason I’m keeping the display open, that way an airflow exists between the pixels and everything is kept below 40°C.

It is not the first matrix made of  neon bulbs, here is a nice modular one made by Robin Sterling. (@RC_sterling) :

And an other one by @cronos_sv spotted by dangerous prototype at Tokyo Maker Faire 2013.

othermatrix02

Recently Manawyrm Made 8×8 chainable matrices, featured in an atricle on hackaday:

 

Creative Commons License

Digital Picture to Analog Darkroom print

IMG_7283

regard_nocturneSince 2008, I am using almost exclusively a digital camera. But I am always missing the black and white darkroom prints.

From time to time, I order paper prints of my pictures using online services. They are very good now, especially for color prints. However, and probably due to my picky nature, I’m not impressed by the prints in black and white. Each time I put side to side a professional print with an old print I did in the dark room, I see a difference in tone. Perhaps it is because of the use of color paper event for black and white prints.

But I’m using my film camera very rarely now, almost all my pictures from the last decade are digital. I know it can sounds heretic for true black and white film lovers, but I always had this in mind – how could we transfert a digital image onto a true analog sensitive black and white paper.

 

Recent developments 

Some resin 3D printers uses a monochrome LCD screen. Monochrome because the UV light is not absorbed by the color filter of the usual color LCD. As there is now a small market for these kind of displays, we can now find rather large panels with high resolution.

IMG_20200402_125708-2

This is a 13″ LCD, monochrome, and 4K resolution. It means 3840 x 2160 pixels – more than 8 Megapixels – and a density of 330 pixel/inch (1 pixel is 76 micron). There is no back-light, and it connects easily to a computer HDMI port through an adaptation board. I bought it from Duobond Displays Shenzhen here.

Usually 300 dpi (dot per inch) is used for prints. It could be more dense of course, but it is what I observe on the photographic prints I get from professionals. (See later for close up pictures).

Make a protective frame

The LCD panel is fragile, better to make a frame to handle it safely.

 

Put back the the darkroom in place

IMG_7281

I removed the dust from the projector, get the 3 chemicals and black and white paper. I spent a bit of time to make the cave lightproof, but after all it is not very complicated.

After the first test, I was happy to see that the LCD is perfectly able to block the light with black pixels and let enough light to pass through with white pixels. Making on the paper respectively white and black pixels.

The LCD is put in contact with the paper, the same way we make contact sheets with films. On the images above are the setup with the projector and the LCD panel, a test mosaic, and the result on the paper. The scale on the left is millimeters.

Find a transfer function  

I tried first to tune the LCD panel grayscale using, among others, the gamma value of the picture. Actually the paper and the film have the same light sensibility, only the film has a negative image. And this is not linear compare to my digital LCD panel.

In order to get a reasonably good gray gradient, I had to change too much the picture values. So much that I get artifacts on the paper, the result of a loss in the tones resolution. Even with the source raw 14bits image, I got banding (aliasing) between light gray values. Because the screen itself has a tone resolution of 8 bits: 256 different shades of gray.

IMG_7293b

 

Using time to generate grays 

As a friend advised me, the solution is to use the exposure time to generate smooth gray values: like resin 3D printers do with each layers, here exposing an area longer will give darker tones.

I made a small program to expose square tiles of the paper with different times. The idea is to get a calibration curve.

IMG_7287

cal2

After several attempts I got a curve: time in function of darkness.

It appears that another phenomenon should be taken in account: the paper takes 1 or 2 seconds to react. Then it is very sensible for the first 15 seconds, then it gradually looses reactivity, so it takes longer to have a slightly darker black.

 

The next step is to make a program that translate the tone value into time, and generate the animation. See below the famous Big Buck Bunny as an example (the time between each values is constant on the GIF, but not when generated with the program) :

bbb_anim

bbb-splash

 

Comparisons and outlook

It is indeed quite hard to show with pictures the different feelings of prints. Below, on the left is a professional print with their tunings and on the right is the black and white Ilford paper with my own settings (less contrast and less digital sharpening).

IMG_7292

There is still room for improvements, especially on the light tones, but I prefer the true blacks of the b&w paper. It is difficult to see, and I’m very picky, but the professional print is a bit greenish. On the other hand, the black and white paper is by definition unable to produce colors.

To come back on the resolution, here is some close up of these prints :

IMG_7288

Pixels are visible on both prints and are about the same size. However, the LCD leaves tiny vertical lignes.

I let you make your own conclusions. But I can give you my feelings. I think it is a good solution to get digital pictures printed on a true black and white paper. It will not be better than a print from a film or high quality prints from a professional. However it gives good result in roughly 6 min. One minute for exposure, 2 minutes revelation bath, 1 minute stop bath, and 2 for the fixing bath. Rinse with water, et voilà 😉

IMG_7286-2

 

Creative Commons License

Mitigate the LED bright spots

IMG_6876PSicon

As a Playstation lover, I liked the concept of the decoration I saw on playstation-gear.com.

However, I was wondering if there is a way to make the light more equally diffused on the surface of the icons. It is as well a nice DIY exercice for the weekend.

First lets 3D draw the models with Fusion360. The shapes are hollowed and closed with a cap holding the LEDs:

fusion03

I populated the caps with SK6812 RGBW leds, and control them with an ESP32:

IMG_6864

I printed the body in one part, changing the filament color after the first millimeter to have the front transparent, but not the sides. I painted the inside with white acrylic to enhance diffusion:

IMG_6880

Then the idea was to diffuse the bright spots cast by the tiny LED. So I took a picture of them right away:

IMG_6862-2

Clean and filter this picture to have a black and white image representing the light intensity on the icon surface. I used the Fusion360 plugin image2surface to generate a mesh. Converting this mesh to t-spline surface, then cut a body with it to have the diffusion volume proportional to the light intensity.

Print this diffusion volume in transparent and assemble the 3 parts:

It’s not perfect and the process can be iterated, but with the right colors and a bit of animation, I think it is as good as the sold one.

IMG_6885

The 3D files can be found on thingiverse here. And the ESP32 code here : https://github.com/pierre-muth/ESP32PlaystationIcons

IMG_6876

Creative Commons License