Interfacing PTC06 UART camera with micropython

For a while I was looking a simple camera that I could use with micropython and ESP32 board.

Initially I looked at Arducam 2MP camera, but that turned out to be a real pain to interface with, and it took up way to many IO pins for my liking. The micropython is barely fast enough to actually do handle the packets. Of course there weren’t off the shelf library to do what I wanted. In addition the image quality was not great, even though it was a 2MP camera.

I decided to try a low cost UART (serial) camera instead. Downside is the camera only 640×480, the upside is that the power consumption is around 30mA (half of what the Arducam is). Another upside that the camera is physically smaller (specifically the lens). Most importantly the UART protocol the camera uses is very simple, and it only needs two IO pins to operate.

Continue reading Interfacing PTC06 UART camera with micropython

Interfacing INA219 Board with micropython

I needed a solution to monitor both current and voltage for my battery powered microcontroller projects.

The gotcha was in the measured input being above the Vcc of the microcontroller.

I found INA219 based boards to be suitable. Except there was no library for micropython (which I use for quick prototyping and generally get things done).

Continue reading Interfacing INA219 Board with micropython

Predatory practices of Dash Cam manufacturers

Recently I was contacted regarding my dash cam GPS coordinate extraction script. The request was regarding wrong data being produced. I have addressed something similar in the past, so I decided to have a go at this one (I like a challenge).

Unfortunately I was presented with this:

00052eb0  00 20 00 00 63 6c 75 72  00 00 40 00 66 72 65 65  |.|
00052ec0  47 50 53 20 f0 03 00 00  59 6e 64 41 6b 61 73 6f  |GPS ....YndAkaso|
00052ed0  43 61 72 00 00 00 00 00  00 00 00 00 00 00 00 00  |Car.............|
00052ee0  00 00 00 00 00 00 00 00  16 00 00 00 16 00 00 00  |................|
00052ef0  39 00 00 00 e5 07 00 00  04 00 00 00 08 00 00 00  |9...............|
00052f00  41 4e 57 00 00 00 00 00  ad bb 79 aa 9f 20 c6 40  |ANW.......y.. .@|
00052f10  c9 fd 0e 45 91 98 c1 40  37 a6 75 41 33 33 a7 41  |...E...@7.uA33.A|
00052f20  33 58 5a 55 4e 4e 31 35  39 35 32 39 37 34 36 35  |3XZUNN1595297465|
00052f30  59 4e 44 53 01 00 00 00  00 00 00 00 00 00 00 00  |YNDS............|
00052f40  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Poking about I realised the data is not simply obfuscated…

Eventually I stumbled upon this:

According to exiftool forum the player uses an internet service to decode the data, which is a huge bummer.

I will try to decompile the player but at this stage I don’t believe I will have any success.

To add an insult to injury the dash cam manufacturer asked the dash cam owner not a small amount of money to decrypt these coordinates. Actually you could outfit a small fleet with new cameras from Viofo for the amount of money they asked.

So here are the brands so far to avoid (do not buy them):


or any brand that requires their own player to playback the coordinates.

Brother MFC-9320CW No Ethernet Link Repair

After the lightning strike on our mains transformer one of the printers (Brother MFC-9320CW) lost Ethernet link.

Upon further troubleshooting I concluded that the PHY chip gave up the ghost.
The chip in question is ASIX AX88796BLF. It appears from the board it has absolutely no input protection what so ever, hence it gave up the ghost.
A bit of warning: the AX88796BLF comes in QFP64 7mm x 7mm package with a microscopic 0.4mm pin pitch. I would not recommend this repair without hot air.

Continue reading Brother MFC-9320CW No Ethernet Link Repair

Converting DeWalt DCB101 110V charger to 240V

Here is how I converted north American Dewalt DCB101 to proper supply voltage (warning: do it at your own risk).
I have made this conversion based on many internet forum posts and youtube videos.
Note: there are at least two versions of this charger and newer version requires rewinding the transformer (at least according to internet).

Why? For some stupid reason 240V chargers locally cost 2 to 3 times more than in USA.

Continue reading Converting DeWalt DCB101 110V charger to 240V

Hate ads on your smart phone? Pi-hole it permanently!

Sorry about spammy headline ;).

Below I will describe how I got rid of ads on my android phone without rooting it.
It is very easy to get rid of ads on an android smart phone if you have root access. Unfortunately pesky manufacturers insist on declining warranty if the phone is rooted.
I will probably one day test this is in small claims court for a cheaper phone. I digress…

The requirements:

  • Some linux box/container/VM. In this post I used Ubuntu 16.04 LTS
  • Public IP on the box from above
  • Some linux/cli/unix experience

How does it work?

  1. Smart phone connects to the Linux box via OpenVPN
  2. Linux box is running Pi-hole which acts as a selective DNS server
  3. ???
  4. Proft!
Continue reading Hate ads on your smart phone? Pi-hole it permanently!

Simple IMAP to IMAP migration/sync tool

I had a need for a simple IMAP to IMAP sync tool, yet the only useful things I could find were offlineimap and imapsync.
The offlineimap is too complex and does not exactly do what I want; while the latter went commercial and not is not a clean install (requires messing with CPAN/perl libraries).

How hard can it be to write one?

Here it is:

The configuration is fairly simple (and self explanatory):

trash=Deleted Items


Here how it works:

It logs in into both IMAP servers and basically copies (with optional source deletion) the messages across. It also avoids duplication by checking Message-ID header. It should be stable enough to “daemon”-ify.

Here is a systemd unit for it (if one wants it to run all the time):


Description=IMAP to IMAP sync tool



GT06E GPS Tracker Part 1: Implementing communication protocol – WTF is CRC-ITU???


As an experiment I bought a relatively cheap GPS tracker that supported 3G (most of them at the time were 2G only).
After quick google search I found a suitable model GT06E from Concox.

The idea was I would implement my own server, as I do not trust 3rd party GPS tracking services (who would?), especially free ones ;).

I did not realise at the time what a mess the protocol is.
The “engineers” who wrote the spec for the protocol are crazy! They reinvented the wheel, which instead of tyre utilizes boots.

Continue reading GT06E GPS Tracker Part 1: Implementing communication protocol – WTF is CRC-ITU???

Beware of fake Philips HID Bulbs!

I decided to replace the 6300k HID bulbs on one of my cars, with more sensible 4300k OEM solution.

I came across reasonably priced Toyota Genuine Bulbs on (NZ ebay type of thing).

The particular bulbs I was after were D4R, or Toyota Genuine Part 90981-20015 (alternatively Philips 42406).

They were priced (~$80NZD) similar to Genuine Philips 42406 in USA (~$50USD), so seemed to be reasonable. The Toyota Genuine are after all Philips 42406 in TGP box.

When I tried to fit the bulbs I noticed they were extremely tight. Then I looked closely and did some googling.

Continue reading Beware of fake Philips HID Bulbs!