Programs to display information to LCD framebuffer
#1
Lightbulb 
Hello,
The interest of the program set is to generate a PNG file contening CPU load and temperature, Wifi link speed, time and battery voltage then display this file to LCD framebuffer out of driver update zone.


Battery voltage display is optional. To get it work, you will need to make a voltage divider then connect it to a ADC input.
In my case, here is the schema using L2R2 addon board:

(Battery+) Vin---+
                         R1 (resistor)
                         +-------------------Vout (ADC)
                        R2 (resistor)
(Battery-) gnd---+

Vin is solder in positive pin on one of the battery connector.
gnd is solder directly on addon board.
R1 is 9.1kohm resistor and R2 is 22kohm resistor.
Vout is solder in a ADC input.

/!\ Please note:
When handheld is off and not charging, this setup will drain a little bit of current, around 0.2mah for me using these resistors value.
The lower resistance value is the higher current draw will be. In my initial test, I was using 91ohm and 220ohm and the current draw was around 10mah, so if handheld was offline for one full week the battery was losing more than 3/4 of its capacity Undecided

Edit: Now use dispmanx based software to avoid modifications of framebuffer.


To compile these programs you will need to have g++, libgd, libpng, libfreetype, libjpeg dev packages setup on your system.
/!\ Please note: code is far from optimized, never tested in Freeplay Zero platform.

Real world example: https://forum.freeplaytech.com/showthread.php?tid=4696
Github: https://github.com/porcinus/FreeplayInfo2Overlay

For GL/Dispmanx 'OSD': https://forum.freeplaytech.com/showthrea...74#pid7574

Todo/ideas:
- [DONE] Add overheat / undervoltage icon.
- [DONE] Avoid use of ffmpeg and omxplayer, https://github.com/hex007/eop implemented as img2dispmanx, speedup overlay display by 0.7sec.
- [DONE] Add low battery (based on gpio, need to be set in program argument)(should be pin 7 in cm3).
- [DONE] Now detect screen size by itself.
Reply
#2
Hey Porcinus!

Thanks for the great additions.

I'm wondering if you tried upping the resistance again to like 91kohm and 220kohm to even further reduce the current draw.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#3
Hello,
I did but for some reason, the adc value was a mess, maybe current running thru it was too low.

For the current draw:
- Stock system : 32µAh
- With 9.1kohm and 22kohm resistor : 154µAh

I also tested out with a DS3231 RTC module using the system battery as backup battery and it draw less than 1µAh on it's own.
Reply
#4
I guess that cranking up the resistor values can also make the ADC line more susceptible to outside noise (from other nearby wires/traces). We discussed this stuff here, and there's also another method that could be interesting. Essentially you could put a mosfet in series with R2 (to ground) and then just turn on the mosfet whenver you want to read a sample. You could wire it so that it's only "on" when the unit is on, or you could wire it to a GPIO so that you could turn the circuit on, take a reading, and turn it off. Since you don't need the resolution to be super fine (like you could take a reading every 5 to 30 seconds or whatever), it would only draw power a small fraction of the time (using the GPIO method). Maybe that's worth considering.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#5
Yes, I have think about a mosfet too but only regarding the "on" state.
Since it drain less that 1mA/5hours, it's not really useful to use gpio I think.

I will take a look about mosfet, hope to found one on a old board.
Reply
#6
If someone interested about RTC, it a DS3231.
Plastic pad in the header is shorten to around 1mm, downside is insulate using high temperature tape.

2 modifications need to be made in Raspbian : https://www.andreavinci.it/blog/en/2018/...ime-clock/

For debugging purpose, i2C address is 0x68.


Attached Files Thumbnail(s)
           
Reply
#7
I have to say that I really love putting stuff like the L2/R2/analog add-on board out there and seeing what people like you come up with for mods/additions/uses!

What do you use the RTC for? I mean, like what made you want to add it?
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply
#8
Totally true Wink

Just wanted to be able to get the time when having no available wireless, aside of this I am thinking about shutting down lcd backlight when no input detected for some time, emulationstation really miss options to execute script when entering/quitting screen saver.

Edit: I understood the way to use npn transistor but I only have C1815 on hand, when applying 5v+1kohm to base, it drain almost 5mAh (around 40x more than leaving voltage divider as is) :/
Reply
#9
Edit: Update info2png.cpp
Adding ability to log battery voltage from system startup
add '-vbatlogging' argument to use, data will be put in 'vbat-start.log', format 'uptime;vbat'

If you have any software idea, feel free to ask Wink
Reply
#10
(12-07-2018, 06:18 AM)Porcinus Wrote: Totally true Wink

Just wanted to be able to get the time when having no available wireless, aside of this I am thinking about shutting down lcd backlight when no input detected for some time, emulationstation really miss options to execute script when entering/quitting screen saver.

Edit: I understood the way to use npn transistor but I only have C1815 on hand, when applying 5v+1kohm to base, it drain almost 5mAh (around 40x more than leaving voltage divider as is) :/

I think that the https://github.com/juj/fbcp-ili9341/ driver has some detection for sleep mode.  You could maybe look at that and see if there's a good way to detect inactivity.  I know that I sent him a backlight brightness controller to test with, but I actually never heard if he worked on that or not yet.

I'll see if there's any suggestion for the mosfet idea.  It's not my area of expertise, but my colleague is good with that stuff.
Card Fighters' Clash 2 English Translation ( http://cfc2english.blogspot.com/ )
Neo Geo Pocket Flash Cart and Linker Project ( http://www.flashmasta.com/ )
Avatar art thanks to Trev-Mun ( http://trevmun.deviantart.com/ )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)