.bmp from graphics library?

Status
Not open for further replies.

bicycleguy

Well-known member
Want to display battery cell voltages from an electric car to the cars LCD display something like below.

batteryStatus.jpg
The 112 cell voltages are read from the cars CAN_bus by a Teensy 3.2. and converted to graphs and additional statistical information.

The car has a proprietary, closed, Windoz CE implementation (MyLink). It will however display pictures from a USB port. I want to build .bmp pictures from the data and present pictures to the USB port with the Teensy. The initial thought was to use one of the lcd libraries like Ili9341 or GLCD to build a picture and then dump it to .bmp or jpg. I have not found library support for this however.

Additionally the native display is 1024x614 16bit/pixel. That works out to ~1.3mb file....

I know it probably makes more sense to dump the data to an iPhone over BluetoothLE and do the graphics there, but anyone know of a graphics library to build a .bmp on the Teensy?
 
It will however display pictures from a USB port.
What does that mean? It can read USB mass storage? What's the protocol?
Additionally the native display is 1024x614 16bit/pixel. That works out to ~1.3mb file....
That's not an issue. It obviously won't fit in Teensy RAM, but you could build an image in strips.

Building a BMP is easy. But I don't see how you can do the USB transfer. Teensy 3 doesn't have a library for USB mass storage capabilities.
 
Sounds like you want the Teensy to emulate a USB memory stick which is populated with a dynamically generated .bmp image? I don't know as that's possible right now. If you could get the teensy to pretend to be a USB mass storage device, whenever you wanted to update the image, you might have to disconnect and reconnect the USB to trigger the embedded display device to re-scan the virtual filesystem to detect the new image.
 
BMP is not complicated, should be not too heavy to write your own code for that.
Thanks Frank,
guess I've become Arduino-ized. I'm hoping someone has already done the heavy lifting.

What does that mean? It can read USB mass storage? What's the protocol?

That's not an issue. It obviously won't fit in Teensy RAM, but you could build an image in strips.

Building a BMP is easy. But I don't see how you can do the USB transfer. Teensy 3 doesn't have a library for USB mass storage capabilities.

I'm assuming USB mass storage. It can read png, bmp or jpg off a windoz formatted thumb drive. Thought I had an Arduino shield that could look like a thumb drive. I'll have to look.
BMP doesn't look to bad but the characters stuff would be painful.

thanks
 
whenever you wanted to update the image, you might have to disconnect and reconnect the USB to trigger the embedded display device to re-scan the virtual filesystem to detect the new image.
I was hopping to just add another picture with newer time based name. Then on the MyLink display press the next picture button.

edit added: Your probably right though. That would suck.
 
Last edited:
That's not an issue. It obviously won't fit in Teensy RAM, but you could build an image in strips.
That is the way to go and has been used back in time in the likes of Atari 2600 etc. Contrary to these it is a "tad" bit more complicated due to the complexity of his image (you have to keep track of a good few things to render it line by line).

Sounds like you want the Teensy to emulate a USB memory stick which is populated with a dynamically generated .bmp image? I don't know as that's possible right now. If you could get the teensy to pretend to be a USB mass storage device, whenever you wanted to update the image, you might have to disconnect and reconnect the USB to trigger the embedded display device to re-scan the virtual filesystem to detect the new image.
If it really comes to that, maybe some additional circuitry could help doing the reconnect-thing automagically whenever it is triggered by the Teensy (assuming that there is no other update option working).

BMP doesn't look to bad but the characters stuff would be painful.
If it weren't embedded context I'd say check out Freetype. Back in the days you had bitmap fonts. What you can do, for example, is using Freetype to prerender you the needed things in a font of your liking on your host machine, store the bitmaps and use them to render the characters then on the Teensy. You can also think about compressing these prerendered fonts a bit, i.e. use 16 (= 4bits/pixel) or even just 4 levels (= 2bits/pixel) instead of 256. Also: bin2obj and similar stuff might be worth checking out to get the stuff compiled into your binary.

PS/edit: Also check out things like PCX (oldschool graphics format), they used a rather simple, but in such cases effective RL/runlength encoding scheme (especially for bigger scaled up fonts/glyphs), which might come in handy to save more space with prerendered bitmaps. Keep in mind that together with a line-by-line rendering approach it is probably best to compress each line of the prerendered glyph/character independently.
 
Last edited:
Thanks for the help guys, I'm going a different direction.

Seems like if I'm nuts enough to bit bang the bmp (nice ring to it), then I may as well start with one of the LCD libraries, add the save to bmp feature to that, then figure out how to make that work for a bigger bmp.

I program as a hobby but bit banging graphics isn't fun anymore. Kind of reminds me of doing graphics on the Commador64 a long time ago in a ...

I think the easiest way to proceed at this point is to add wifi to the teensy and write something on the iPhone to handle the graphics. I'll have an interactive app and it can write a .bmp file if I must see it on
the cars display. Hard to believe that making an app is easier than making a bmp, but I think it will be. (Ive written a few apps recently, yaa for objective C)
 
Status
Not open for further replies.
Back
Top