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.

IMG_6876

Creative Commons License

Rear car Speedometer

Context

It’s subject to debate and delicate, but maybe you experienced this situation yourself while driving a car. The driver of another car, just behind you, would kindly like to travel at a higher speed. On your side however, you apparently yet travel at the maximum legal speed.dJE4v0b

An hypothesis is the speedometers of both cars don’t agree. So why not showing in real time your actual traveling speed on the back of the car ?

Let’s make it looks like a Sonic the hedgehog power-up monitor !

Reading the car speed

speedo_1I could use a GPS module to have the car speed, but I think there are two disadvantages. First, we loose it on tunnels, and second I’d like to show what I’m reading on my dashboard.

My first idea was to use a bluetooth OBD plug, and then connect to it with an ESP32. But I did not succeed because the OBD dongle I have uses classic bluetooth and not BLE. In addition I did not found a 12v power line on the trunk that is switching off once the ignition key removed. I don’t want to drain flat the car battery.
IMG_20191008_150300
So I re-purposed the cheap OBDII reader. Luckily it uses an ELM327 clone and the bluetooth module can be de-soldered. That saves me the code of the raw CAN-bus handling, the ELM327 uses simple serial AT style commands. And it saves me the design of the CAN-bus circuitry.

Passive display

To display the car speed I’d rather choose the most passive, simple technology while having a large digit size. It is out of question to use something that emits light.

E-paper could do the job, but large displays are pretty expensive, and I’m not sure if they can handle the rough condition of a car parked in sunlight or a freezing winter.

Electro-mechanic Flip display would be a good choice if only the big 7 segments units were not so expensive. Besides, I’m not sure the continuous flipping would be good for the display and the driver ears.

Fortunately we can still find good old fashion 7 segments LCD in large size. I yet use some of these panel on the BIG_CLOCK project. The biggest apparently are made by Lumex, the LCDS101D40TR. The character size is 10×7 cm.

speedo_2

Only two digit is relevant in my opinion. At a speed faster than 100Km/h, digits should be unreadable due to the safety distance. So we have to drive only 14 segments. The PIC16F19156 can drive them directly, without multiplexing.

The code simply take the received byte on the serial port and display its decimal value from 0 to 99.

Processing

Originally I planed to use a wireless bluetooth link, it explains why I started and kept an ESP32. It’s a bit overkill for the task, but there is nice libraries for plenty of devices. I used Platform.io on Visual Studio Code, with Arduino, for the development.

One interesting point here is the use of the 3 serial ports. One for the programming / debug, one to the ELM327, and one to the LCD screen.

I also add a little Oled display for debug and showing what speed is acquired.

3D printed enclosures

To put the two electronic boards plus some wiring, I made a case that fits inside the rear cup holder. Conveniently there is a 12v plug just aside. I need 3 cables: the 12v, the connexion to the OBD plug in the front, and the connexion to the rear LCD. I re-purposed old Lemo 3 way plugs, a perfect fit.

On nighttime everything glows red, without being annoying.

To hold the LCD panels it appends I have a Sonic the hedgehog plush on the back of the car, why not try to mimic the power-up monitors of the video game ? I printed this enclosure in PETG because I had bad experience with PLA on direct sunlight. I tried to have an ajustable, stable and discreet design.

And here is how it looks like on the car :

IMG_20191009_114723

The 3D files, the PIC code and the ESP32 code can be found here.

Creative Commons License

A bed Lamp – Sunday project

bedLamp

An issue of falling asleep while reading in bed is the lamp will be on forever. A lamp that fade gently off after a certain time is strategically good for a peaceful couple relationship and for a rainy Sunday project.

Few constraints

  • Fading off after 1 hour
  • Pseudo color (temperature) control
  • 5V powered

Electronics

LEDThe LED used is a SK6812 with 4 channel, R, G, B and warm white.

The microcontroller is a PIC12F1840. A potentiometer gives an analog value for the color.

To control the SK6812, I used the work of Steve Phillips. He discover that the serial protocol is easier to implement than described in the SK6812 ‘datasheet’. Basically “A 0 bit is given when the high voltage time is less than roughly 0.35µs.” and for a 1 bit “As long as you don’t pull low for 50µs between high voltage points, you are fine.

schema

The analog value is read in a loop and is used to determine the color and intensity of the led. If this value does not change during 1 hour, the color is faded gently.

The PIC code is in this repository : https://github.com/pierre-muth/Bed_Lamp

3D printed body

I used Fusion 360 for the 3D drawing. A set of gears make the potentiometer rotation linked to the base rotation. In order to get a reasonably directional cone of light, I made a “nozzle” like shape, that can be orientated thanks to a ball joint connection.

Printed in PLA during a night on a Prusa i3 MK3, and the inside is painted in white. Files are on thingiverse here.

IMG_6790

Result

IMG_6782

IMG_6783

bedLamp

Thanks for reading!

Creative Commons License

The quest of a beacon for cats (part 2)

IMG_6452

It’s been few month now Mio is wearing the beacon, so what can we conclude ? First part: The quest of a beacon for cats (part 1)

Battery lifetime

The CR2032 battery lasted 100 days, with 60 seconds between RF emissions. It corresponds to roughly 144’000 pulses. As the beacon transmits the battery voltage, I could log and trace the trend. However the voltage of these battery don’t drop gently at the end of their life. There is a slight slope a month before dying, but I suppose it’s better to anticipate and exchange the battery after 12 weeks of use.

batteryLifetime

Field research

Mio’s collar has a lock that opens itself if too much pull strength is applied. It appended once the collar stayed outside because Mio hang it up at a fence (or maybe it’s possible I didn’t close it correctly).

It was interesting to search it by looking at the RSSI value on the receiver. It was fun as well for my neighbors, how saw me roaming around with an antenna. In the end the necklace was lying on a fence something like 50 meters away from the house. By making circles around I could estimate the range to maximum 100 meters.

As it was rightfully pointed out to me, the beacon allows to find the collar, not the cat. But the chances Mio keeps the collar is greater than nothing at all.

Conclusion

I’m rather satisfied by the battery lifetime and the range, so I will probably keep this solution for a long time. We really enjoy seeing the beacon signal chart, it reassures us to know Mio is around.
Creative Commons License

3D printed Synchrotron Magnet replica

 

The Cern Proton-Synchrotron (PS) is a fascinating machine. While there are many synchrotrons around the world, this one started its operation in 1959. The PS, which is nowadays part of the acceleration chain of the Large Hadron Collider (LHC), measures 628 meters of circumference. It was the first strong-focusing synchrotron (or alternating-gradient focusing), at a time when synchrotrons look like the BLN Cosmotron.

The PS main magnet units combine dipole and quadrupole magnetic functions, weight more than 30 tons and are around 4.2 meters long.

There are a 100 of these magnets along the PS ring. Some coils have been replaced, but they are still the same and the yokes are untouched.

For more details about the PS and its history, there is a complete and nicely written report available on the Cern website: http://cds.cern.ch/record/1359959

In 1959 John Adams (leader of the construction team at that time) announced the successful acceleration of protons up to 24GeV.

If you pay attention, on the picture you can spot a small scale model on the desk.

That is the target of this blog post.

2-0290.jpgThere is plenty of documentations and archives at Cern, and it was impressive to find the original mechanical drawings of the magnets. So I started Fusion360 and played with the drawings. Of course, there are yet 3D models files, but they are extremely detailed and it would shortcut the fun.

Let start with the yokes:

The magnet blocks stand:

Coils, supports and feet:

And let’s print it :

The scale is 1:20 and pictures bellow show the difference with the real thing:

IMG_6546

IMG_6549

The STL files are in this repository : https://github.com/pierre-muth/PSMagnet

Thanks for reading !

Creative Commons License

Images from Cern are free of charge for educational and informational use. The Cern term of use for audiovisual media can be find here : https://copyright.web.cern.ch/ . This project was realized as a hobby, outside Cern.

Quick & basic equatorial mount motorisation

IMG-20190225-WA0000

Several years ago I had a challenging combo in mind. Giving a try to astro-photography while not ruining myself.

orion mini EqI didn’t start with nothing as I would like to use my camera, a full-frame DSLR with a variety of lens. I don’t have any experience in astro-photography, then I bought the Orion Mini-Eq, a beginner tabletop equatorial mount for camera, plus a small DC motor. But I didn’t manage to get decent shots, and the mount start to be dusty.

I recently focus a bit more on this subject and I tried to improve myself on two key ingredients. The orientation and the motorisation.

The main axis of the mount should be precisely set parallel to the Earth rotating axis, in order to compensate this rotation with the motor. This will enable taking long exposure picture without start trails.

Orientation

In the north hemisphere a good approximation is to target the polar star (Polaris) to align the main axis. But it implies, in my case, to set the second axis precisely to 0 and have the star in view. The markings on this mount are not really helpful and Polaris is visible only on one side of the house. So I printed a plate with a cylinder that fits in the bottom tube of the main axis. It is precisely at 46.28 degrees, the latitude of my place.

orion mini Eq print plate

On this plate I can put a bull’s eye bubble level and a compass (or a phone). It is not perfect I imagine, but it helps me learn.

Motorisation

The main axis rotation speed should be one turn per day, the same as the Earth.

motor gearboxI found on eBay some stepper motors with a gearbox. The gear around the Eq-mount divides the rotation by 100 already, so adding a 1:100 gearbox on the stepper side divides it, in total, by 10’000. There is 86’400 seconds in a day, so the stepper motor speed should be 8.64 seconds per turn. This gearbox has a compact planetary gears arrangement.

Controller

silentstepstick-tmc2130-stepper-motor-driverI choose the famous TMC2130 stepper motor controller, mainly because the silent StealthChop mode promises a smooth rotation. In particular the Silent-Step-Stick board of Watterott/pololu, that simplifies the wiring.

An article in hackaday describes in detail how these controllers work. This time I would like to have something  useful rapidly, I then took an ESP32 with the arduino framework. I could just plug libraries for the TMC2130 and for a small LCD character screen.

IMG_20190315_103535

The ESP32 has to send pulses to the stepper motor controller, corresponding to the steps we want to generate. The motor has 200 steps per revolution, and the controller supports 256 micro-steps. It means we have to generate 51’200 pulses per motor revolution. We saw that the motor has to spin at 8.64 seconds per turn, so it gives 5925.9 pulses per seconds.

Coming from tiny 8bit micro-controllers, I first used a timer of the ESP32 to generate the pulses at a precise time interval. The ESP32 has timers that can be set down to the 80Mhz clock and the counter it on 64bits, which is quite remarkable. I set the prescaler at 80 to count micro-seconds, and the counter to 1687 in order to generate interrupts 5925 times per seconds. On the interrupt routine, we just flip high and low the step pin.

However I didn’t expect that the generated pulses don’t have a stable period. I naively forgot the ESP32 arduino framework probably relies on RTOS, thus some interrupts has greater priority than my timer. The period time in average is correct of course, but the period varies pulse to pulse.

After some googling, it was obvious to use the PWM instead. Everything is there with the ledc() function, and can be set with a 0.4 Hz resolution. I measured the pulse period difference between timer and PWM method :

timerVSpwm

Enough confident after this success, I just add three buttons to change the digit values of the output frequency, and the rotation direction. Also an option to stop the motor, it should not spin when the power is cut.

Next step is to make a basic case to put everything inside, my awful wiring don’t deserve public views.

And finally, I attached the motor on the Eq mount.

With everything attached, the system looks like that:

IMG_20190317_115945

The two following pictures are single frames, quickly processed from the raw camera files. Bellow is the Orion nebula, the tracking speed is not perfect as the stars still make trails. The theoretical value of 5925Hz micro-step frequency is certainly off due to the ESP32 oscillator real value. The exposure time is 60 seconds.

IMG-20190225-WA0001

Bellow the Andromeda galaxy, 60 seconds as well but with corrected frequency, hence a better tracking.

IMG-20190225-WA0000

Conclusion

I have now no excuse for waiting a clear night and start learning picture stacking with advanced astro-photo softwares !

You can find the arduino code and the 3D files here on github: https://github.com/pierre-muth/QuickEqMountController

Creative Commons License

The quest of a beacon for cats (part 1)

IMG_6409Mio is a tiny female cat, with a rather independent and proud way of life. She spends quite a lot of time outside doing… well… important cat stuff, among proving her duchess status to the other neighbor cats. However, she never misses us, each evening after work, when we come back home. She can enter the warm house in order to get the well deserved food and attention.

Until one day. And the day after.

It affected me far more than I could expect, but fortunately the worst things I started to imagine were false. Mio came back home. We conclude she might be being locked by mistake in a barn from the neighborhood. That’s where started the idea of a small RF beacon for Mio. It should to be very small, at least a month of battery life, and can enable a kind of search with a receiver.

What exists

I usually enjoy to think about and make solutions by myself, but what exists yet on the market ?

cat_PawTracker

thepawtracker.com

There are some expensive modules that combine GPS and GSM. Usually they come with a subscription (monthly fees) and you get the beacon location from a website. The few days of battery life is problematic, and they cannot be realistically attached to a small cat due to their size.

Some bluetooth tag seems to have some success. They are small and have a long battery life. These tags have however only a 10th of meter range, and some relies on the proximity of a smartphone, with the special app’ installed and running…

balise500pxFinally, over internet I found a very interesting article of someone having the same concern. (https://www.f1nqp.fr/articles.php?lng=fr&pg=144 in french). I’m less confident with analog RF electronics. In addition, the size of the antenna wire is not very confortable. However this solution should be kept.

Exploring RF modules

I discarded the modules working at wifi frequencies (2.4GHz) for two reason. Maybe I should come back here later, but with a coin-cell battery budget, these frequencies are absorbed easily by walls.

IMG_6406

I made some tests with three different RF modules. From left to right:

1 – A basic 315Mhz transmitter

These modules seems to meet the low power requirements. I can even use a TV usb dongle as SDR to receive and find the beacon. The difficulty comes from the antenna. A 1/4 wave antenna for 315MHz is 23cm long. If I spool the wire inside a small case, it makes a coil and degrades dramatically the antenna impedance/efficiency. So the range goes down to something like 10 meters.

2 – Lora module based on SX1278 at 433MHz

These LoRa modules are amazing. They have a really huge range, more than 500 meters. But the problem is still the antenna at 433Mhz. If I use a simple wire, wrapped in the case, I must increase the output power to the maximum (~+17dBm). Then the battery dies after a day. Mainly because the peak current is up to 100mA, thus not suitable with coin-cells.

3 – ST electronics module base on SPIRIT1 at 868Mhz

The ST SPSGRF module integrates the antenna, in a very small board. The power consumption is very interesting as well, so let’s go a bit further with them.

For each module, made a draft case. I choose a small PIC12F1822 in SOIC package to drive them.

IMG_6407

ST SPIRIT1 tests

The PIC code basically setup the module and send a message every minute. Fortunately, in addition of the numerous application notes, ST provides a little application (STSW-CONNECT9) to generate dthe setup C code of the Spirit1. It is very convenient as the registers are quite numerous. The message sent is just composed of the battery voltage and the battery voltage drop during the RF broadcast.

The 3D drawing is done with Fusion360. To make the case waterproof, I used neoprene glue on the outside join between the cap and the body. With the screwdriver tool that fits the pattern on the cap, there is enough torque to tear the glue appart to unscrew it. I had to pay attention to not cover the antenna with the coin-cell battery. Event shifted like that, I’m sure it reduces the transmission efficiency.

 

 

Receiver and integration

On the receiver side, one interesting feature of the Spirit1 is the RSSI value – in received signal strength. It not gives an absolute distance between the two modules, as it is greatly dependent of the obstacles, but it rather gives an idea.

IMG_6413I used the ESP32 on this side for two reasons. First because there are nice libraries for the RF module and different screens, and because I would like the wifi connectivity. With wifi, I can connect it to my logging station and observe the evolution of the signals. I had a PCD8544 LCD, pretty much enough to display few values and a small history chart. The screen on the receiver let me take it outside and try to locate the signal. It displays RSSI, voltages, and a countdown in order to knows roughly when the beacon will emit.

The PIC code, the ESP32 codes and 3D models are on this github repository: https://github.com/pierre-muth/RF-cat-beacon

 

 

From the tests I made, the range is around 100 meters. I had the receiver outside in the village, while the cat is (sleeping) in the house (which has half a meter thick walls).

I have now additional logged data channels, I can observe the trends of RSSI and battery voltage on logging station.

 

 

Conclusion for now

I need to wait more to conclude on the battery lifetime. Over the last 10 days, the voltage seems constant at 3V. I could increase the transmission rate if possible.

I’m not sure about the reception range, is it enough to locate the beacon by walking around in the village? That’s why I should continue to study the other solutions. For example, I just saw it exists 433MHz ceramic antenna as well. Maybe it enables the use of the LoRa module at low power. They are still interesting as their modulation scheme makes the reception very sensitive.

Thanks for reading and take care of your cat.

Creative Commons License