Bitmap (BMP) to RGB565 ansi C Array Converter

I've been playing with some LCDs again. This current one has a model name HX8352. The display looks good, is very affordable and the solderable ribbon connection works out well for me for what I wanted to do with it.

HX8352 LCD

It is capable of displaying 16bit colours. The expected color format per pixel is RGB565. Meaning that the information of mix of red,green and blue is squashed into 16 bits. Red occupies 5 bits up the MSB end, Green occupies 6 bits in the middle and Blue occupies 5 bits at the LSB end of the 16 bit word.

I decided that I wanted to be able to display a bitmap on the display in a project. It was a small project which did not include any removable storage or files system or the like. My intention was to store the bitmap in a simple 16 bit word array. It was going to be most convenient for me, given the expected RGB656 format to store it this way. This is not an uncommon thing to want to do. Or at least this is my impression.

I already had a utility called lpcbmp2c. It kind of converted a 24bpp bitmap to an ansi C 16 bit word Array but it had some oddities. I think it may expect the user to only use bitmaps where the X and or Y sizes are divisible by 10 or 8 or something. At any rate, it didnt work for me. Then I tried searching the internet for another likely utility but didn't find anything easily available. So I set out to write my own in C# using Visual Studio 2010 express.


After loading the image and then pressing convert, the program will create a file RGB565.c in the working directory. This will either end up being just the program's folder or the folder that you grabbed the image from. I didn't put any status display in the program. Bigger bitmaps take an extra moment to generate so you might have to wait a couple of seconds for the file to appear in the folder.

Ansi C bitmap array

I've also added in a couple of defines in the rgb565.c file for the width, height and total pixel count.

 Be aware that I haven't put any exception catching in the program so things like trying to convert or load some incompatible bitmap might cause the program to crash. I just wanted it for a bitmap I wanted to convert and it worked so I'm not really intending to do any more work on it.

I am offering the software here for free without reservation including the source. If you find it useful, please add a comment. If you take the software and improve it let me know and I'll link to it even if you're selling it or something.





LS-Y201 JPEG Camera Test Utility

A colleague had been trying to get me interested in some CV (Computer Vision) projects. I suppose I had a passing interest in the topic. The more he talked about the CV C language libraries, the more I wondered how well they would execute in a microcontroller environment. I had bought from ebay some time ago a small serial camera but realised it would need an FGPA to sort out getting frames from it. So I decided this time around I would just start with a JPEG serial camera off ebay. I was sure there would be one on  there somewhere and there was.

Smiley faceThis is the LinkSprite LS-Y201 JPEG serial camera. It has by default a 5v TTL serial interface. There is a footprint on the back for a MAX3232 transceiver IC if you really wanted to run in RS232 levels. With some commands, you can request the camera to take a snapshot and buffer it and then download the image in JPEG form from the camera. It also has IR leds and a LDR to control the output of the IR LEDs.

I get the impression that LinkSprite may have more than one type of shape of this camera / PCB . I don't know if the commands are compatible with all of them.

I'm not sure what the argument would be to use this with a PC unless you were connecting it through a long RS485 bus or something where you couldn't use USB or a WiFi camera. The unit was around $30 and is pretty bare bones. The idea of a serial JPEG camera fits better with a microcontroller or similar project. This was my target. Eventually I'd like to go back to the FPGA controlled camera goal but I thought this JPEG camera would make a good start.

It arrived. I as yet had no micrcontroller dev board to plug it in to that could also display the image or had enough RAM to do some image manipulation. I also had not at this stage yet looked at any of the CV code, libraries or processes.

Well, I wanted to see how usable the image that it captured was going to be and decided that there must be some test utility somewhere. And yes there is an evaluation utility software program available on the LinkSprite website if you know where to look and can bypass their login bollocks.

But no it doesn't work. Or at least it didn't work for me. Maybe I pressed the wrong button at the wrong time or something. Anyway I was frustrated enough that I decided to ignore the fact that I was a poor C# coder and started to write an app anyway.

Smiley face


If I'm asked to take down the manual I will.

I used the Microsoft Visual Studio "Publish" option to create a setup file (why a forms app would need one I don't know) but I  haven't looked into all it's options so sorry if the setup.exe process is annoying. I assume you should really only need an exe. I'll look into this later.

I still have a lot of work to get the utility to a respectable level but it's working well enough for people to try if they understand the hazards. If, like me you just wanted to see something happen, I'd like to think the app's shortcomings will be forgiven for the moment.

There's a couple of gotchas in this beta. And there's a couple of gotchas with the camera. Try not to press other buttons while it's doing things like downloading the file from the camera. I'm not checking for serial errors so if something happens that way, the byte count might be out or you'll get artifacts in the picture. A change of baud rate requires the port to be closed and reopened in the new baud. A successful reset command will take the unit back to the default 38400 baud. A successful change of resolution command requires a reset command or power cycle of the camera for the change to take effect. To take a new picture, you have to "enable jpeg capture mode" or "start taking pictures" command as the manual says. You might have to disable then enable. I'm not sure. I'll have to check.

If you modify and make the code better, do us a favour and mention me. And send me a copy while you're about it.

Eurisko 2013 – After the show

It's now a couple of weeks after Eurisko. I decided that I didn't want to post any thoughts immediately after the event.

The event was a little quieter and a little less well attended and had fewer displays and stall holders than I had hoped for. I mentioned before the show that I didn't even know whether there were any talks happening. I was there for over an hour before somebody pointed me towards the talks and presentations schedule written on cardboard sheets in texta. I was disappointed to see that it looked like I had missed most of an interesting talk only to find that it looked like no one had been in the room at all yet.

Having the schedule only available on the cardboard sheets did mean that things could be added or crossed out or have the times changed if something went on longer or somebody couldn't turn up. Later, a spreadsheet of the expected schedule was projected onto a wall but as the spreadsheet and the cardboard schedules changed, the two got out of sync. It became difficult to trust either copy.

Posted on the website on the day of the event was a heads up about a google spreadsheet that could be consulted to see what things were going on. It wouldn't have occured to me to consult the website while I was at the actual event. Blog posts about who would be there displaying had seemed to only appear a few days out.

It was great to to see Melbourne's Connected Comunity HackerSpace there. They had a lot of interesting stuff to look at and people to talk to as did the East Gippsland Maker Space who occupy a great space in a small old hospital. I was mesmerised by the video tour and had a great chat with Scott Lamshed, the president.

Unfortunately, the AV stage was right next to some other audio themed stall holders. Although I appreciate experimental sound mixing and multioscillator jamming, i couldn't hear the ukulele i was playing around with and having a strum on.

I met John Oxer and Angus Gratton of Freetronics and had a chance to look over a demonstration version of ardusat hardware of which there is of this post, some floating around the earth reading data from sensors and transmitting back to earth below. I managed to catch John's Ardusat talk later on.

I only got a couple of hours sleep early Saturday morning before I flew down from Sydney. By the afternoon I was running on fumes and just about falling asleep in one of the most interesting talks I've been to, let alone at Eurisko. It was on hardware and software development for bionic eye sensors and associated hardware.

By late afternoon on Saturday I was dopey from the lack of sleep and went to see what the Hams had on show. One of the Amateur radio society guys was showing me a receiver call the "beach40" which rang a bell and i mentioned that yes I had heard the name of the receiver project on either the Soldersmoke podcast or HamNation podcast and he confirmed that it probably would have been Soldersmoke and then I could hear in my mind the voice of Bill Meara extolling it's virtues. Things should have clicked at this point but didn't. For some reason, may brain had decided that this guy had also built one as I thought perhaps many hams might for a good design. He offered me the schematic and suggested I might like to build one. He even kindly proffered a resonator to start me off for the IF of a receiver.

Now, I'm pretty bad with names and not quite yet completely submerged into the amateur radio world, I didn't make a connection here with call signs (which was printed on the schematic) as he might have expected me to and suggested that I might have visited his website before. My sleepy mind couldn't think why I might have. Well, the conversation got a little weird then and after politely showing me a few other things I thanked him and was about to leave for the afternoon when I realised the the gentleman was Peter Parker who, if I was familiar with notable callsigns would have made the connection with VK2YE. So I had to go back and assure him that I did indeed know of him and his exploits. I caught a burger and beer at the pub on the way back to the hotel where I konked out at 4pm and didnt wake until 6 the next morning.

I think I enjoyed the talks the most. I now can't remember all the talks and which days they were on but I also attended the Inside you in 3D talk about taking body scans and manipulating them in open source 3D software to extract or highlight organs of interest or to prepare them for a 3D print. Another interesting talk was the life hack journey from being a guy with no seamanship knowledge, to buying, refitting and sailing a boat halfway around the world.

Sunday morning we were met with an energetic prop laden sermon given by Crenn (?) who asked us to think about the role of technology in education and elsewhere. Glove waves hand. If you didn't quite get the deeper meaning, you at least got to walk away with a free piece of monopoly house and a glove and have a game of all 8 ball pool.

I met Alan Crabbe for Pozible and listened to his advice about how to operate a crowdfunding campaign.

Asher Tan gave a talk on his perspective on Bitcoin mining and I caught another talk on "the internet of things" where one of their projects was to be monitoring audio levels of street noise at distances from the source in all directions.

I also had a bit of a chat with the rocket club who had some interesting rockets and radio and electronic rigs for control of things on the rocket as well as reporting gps coordinates, one of which was sent via DTMF over junk frequencies and required a mobile phone app to decipher the DTMF codes into gps coordinates.

The panel discussion on makers with John Oxer, Dave Chanter & Dr Zoz Brooks was great too.

I did think it was worthwhile traveling to see it.  It did kind of feel like it was spread a bit thin. Standing back a little from the whole event, I think only the organisers would be able to tell us how successful it was and whether it met their own expectations. I hope they at least covered their costs. I hope they're able to put it on again next year. I hope it grows to become one of the larger notable make/build/diy events of each year. I note that Adelaide are planning to do a mini maker faire again with the rumour for it to be around September. If Eurisko and Sydney mini maker faire are on again next year around october and November, it will be a busy few months.

Eurisko13 Pre Show

I'm outside The Meat Market at North Melbourne. The inaugural Eurisko '13 event is about to open. I really am not sure what to expect. It's being organised by Ammon, James and Paul, the same characters that were involved in organising the Melbourne Maker Faire (and others). I'm copying files off my camera to make room for content from the event. I had some reservations about how well the event was publicised. The decision to fly dow in the end was a coin toss but I would have been easily swayed with a little more info on whath the venue was like, who would be there. I don't know if there will be talks or anything. If it says so on the website, It wasn't immediately obvious during the time that I was deciding whether to come or not.

Having said that, it's probably a small outfit helping to organise the event and attending to the warm and fuzzies is probably not high on their list of things to get done. Now that I'm here, I'm very much looking forward to it.

3D Printing A Radio Tuning Dial


I've got a radio receiver project I've been working on. I had wanted to see if I could design a tuning dial with an finger dial on the tuning dial that rotated independently. I think this print worked out OK. I'm going to probably print it again but I'm mostly happy with the design. The encoder shaft receptacle is loose so that will be the main thing to fix up.


System Loads and Signals

I use LTSpice from time to time as others do and also find it useful to explain circuit concepts to myself and others. I had thought that if I ever tried to to LTSpice videos that they should for some reason be complicated. Then I decided not to limit myself so here is a simple circuit that explains an effect that sometimes is not immediately obvious. The circuit just explains what can happen to other signals that use a 0V power common return when the 0V return is carrying enough current that there is a voltage drop on the return copper. Anyway, watch the video. Hopefully I explain it better there.

A Raft of Errors. 3D Printing Problems.

I had almost run out of the ABS filament that came with the UP mini 3D printer so I ordered a cheap, locally available roll of white ABS filament from ebay. The result was that the raft and other support bits were really difficult to remove as I demonstrate in the video below. I know that dyes in the ABS filament will affect melting and cooling of the ABS.

I have used black ABS at the makerspace and it was a little less difficult to remove than my problem roll of white. I don't know where they sourced those rolls from. What I do know is that the pearly translucent roll of ABS filament that came with the printer really behaved itself. Supports are pretty easy to remove as is the raft, as shown in the video. It has also been mentioned to be that the filament cooling fan can be adjusted if it is felt that it is required but I'm hesitant to play around with that until I've tested a range of recommended vendor rolls of ABS filament.

Faux Battery Build

For the laser raster scan project, I wanted to be able to control the laser power so I could turn the laser on and off when I wanted to and then maybe later even effectively have a grey scale image by controlling brightness of the laser. I figured the best way to do this would be by replacing the battery with a standing that would connect my wires to the lasers battery terminals. Here is the overview of the design thinking and the assembly.



Laser Raster Scan Project Sneak Peek

I'm halfway through an interesting project. Some time ago I saw Jason Tautic playing with a blue laser on some glow in the dark material. At that time I was making all sorts of suggestions about what he could do with it. Most of them he'd already considered himself. Later, I saw Alan Yates playing with a rotating drum RAM using similar materials. At that time it was suggested that one might try an experiment with slow scan tv image rendering. I don't know that this project could get to that level but I should be able to render some simple images.

I've acquired some of these $3 - $5 1:64 reduction stepper motors and 3D printed some pan and tilt mounts for a little circular mirror I pulled off a $5 telescopic mirror, also purchased off ebay. The gears have some slack in them which is a problem and I'm planning to give them some tension pre-loading as advised by some members at the hackerspace to sort that out. I might have to reprint the pan and tilt mounts to accommodate the changes. I'll have to make some changes to the mounts anyway. The wobble a bit by themselves anyway.


AD9850 DDS Support Board & Firmware

Maybe a year ago now i was playing with a circuit from the AD98xx family but I didn't get around to finishing the build and firmware. In the time in between there have been modules appearing on ebay at very affordable prices. I've had some RF transmitter and receiver projects as well as some sweep generator and other oscillator ideas. So i bought a bunch and put together some support boards and firmware. The output stage on my part isn't great but it does what I need it to. I've recently been using one as a sweep gen to test some transformers I was playing around with. The video here just shows how stable the output appears as far as the frequency counter is concerned. It doesn't necessarily mean that the signal has great integrity.