(https://raw.githubusercontent.com/smaffer/vgax/master/docs/screenshot0.jpg)
Hello everyone,
i've created a VGA library for Arduino UNO.
Here (https://github.com/smaffer/vgax) you can download it.
The library implement a 120x60px framebuffer where each pixel is stored as 2 bits (4 colors). The framebuffer is stored inside SRAM.
The 4 colors generated from the library are not predefined.
You can connect two of the VGA connector pins in different ways, selecting the color combination that you prefer.
To use this library you need only 4 resistors and one DSUB15 connector.
(https://raw.githubusercontent.com/smaffer/vgax/master/docs/wire0.png)
Based on the VGA color video generation (http://www.gammon.com.au/forum/?id=11608) by Nick Gammon (http://www.gammon.com.au/).
Inspired from the game Toorums Quest (http://petenpaja.blogspot.fi/2013/11/toorums-quest-ii-retro-video-game.html) by Peten Paja (http://petenpaja.blogspot.fi/).
AVR interrupt dejitter (https://github.com/cnlohr/avrcraft/tree/master/terminal) from Charles CNLOHR (https://github.com/cnlohr).
Happy Hacking!!
Excellent !!
I also tried colour but I had a tiny jitter problem which I couldnt find a way to solve
One of the 8 colour drivers I did was for the ATTiny13A (amongst others)
Forum Post (http://forum.arduino.cc/index.php?topic=288766.0)
youTube Video (http://youtu.be/YSRZ4AdZVrU)
you can see the jitter problem near the end of the video
Cheers :)
Hi Mcnobby,
your ATTINY project is great!
I've seen the video and your sourcecode.
The problem can be a little jitter in the execution of your interrupt function (1clock or more of delay that depends on the instruction that is in execution when the interrupt happens) . I have got a similar problem but in my case the signal was more disaligned (1pixel or more).
I've saw this video by Charles CNLOHR (https://www.youtube.com/watch?v=RAr5ib21_4I) before i realized the problem.
Otherwise can be a clock problem.. Have you looked the signal with an oscilloscope? It's ok?
Thanks very much, I just like trying to squeeze every ounce out of little chips !!
It is a timer interrupt clock cycle issue, one day I will fix it and hopefully keep it under 1k !!
Do you have any videos/youTube smaffer ?
Here are some of my videos:
(https://i.ytimg.com/vi/Yvdf-pfneA4/mqdefault.jpg)
https://www.youtube.com/watch?v=Yvdf-pfneA4 (https://www.youtube.com/watch?v=Yvdf-pfneA4)
(https://i.ytimg.com/vi/W9ebehFDDRA/mqdefault.jpg)
https://www.youtube.com/watch?v=W9ebehFDDRA (https://www.youtube.com/watch?v=W9ebehFDDRA)
(https://i.ytimg.com/vi/PfN_sQffLkg/mqdefault.jpg)
https://www.youtube.com/watch?v=PfN_sQffLkg (https://www.youtube.com/watch?v=PfN_sQffLkg)
Here is my twitter account:
https://twitter.com/smaffer666 (https://twitter.com/smaffer666)
Very good smaffer !! :)
I dont have twitter, but I subscribed to your youTube :)
Dear Smaffer,
I want to thank you again in this post for your VGA library.
I have created a new post for the Arduino color game I have done using it, here (http://forum.arduino.cc/index.php?topic=328631.0) it is the link.
You can find the code as well.
Thank you Rob Cai!
Good work!
I had a close look at your code today, just trying to see the difference between VGA and composite (PAL)
I believe the VGA line is 32us, whereas the composite line is 64us, so basically it is much harder to squeeze pixels into a VGA signal !
I have just written a new PAL driver for ATMega1284, its 352*280px, it reads BMPs off an SDcard and displays on the TV.. I still havent implemented that jitter fixer.. I havent got my head round it yet !!
I am using timer1 running flat out at 24MHz, I really wanted 32MHz but the '1284 couldnt handle it !! ha ha
Be really good to get the screen flicker free
ANYWAY.. your project looks awesome, I must try it when I get a chance !!
Hello Smaffer, if you are using a CLS() in your library then perhaps consider THIS (http://forum.arduino.cc/index.php?topic=275161.0) post.. I was asking for a way to clear a large array really fast, this was the video array in TVout
Some of the answers are quite interesting, in the end I decided to treat chunks of the array as uint64_t's and clearing them with one line
Also I considered writing an ASM routine that sits in the interrupt somewhere that will clear the display between writing frames to remove any flicker
I am now writing a simplified version of your code for an ATMega8
:)
you can see the jitter problem near the end of the video
Cheers :)
I haven't looked at your code but I found jitter unless I put the processor to sleep (idle mode). It wakes up instantly and always on the same clock cycle so-to-speak.
Here, in particular:
while(1) { // this is the main loop
if (timer == 2) {
// timed code here....
shiftFwd(&H_GREEN_data[0]);
shiftFwd(&H_BLUE_data[0]);
timer=0;
}
You are waiting for the ISR to fire anyway, and when it does you will have a few clocks before you notice if timer == 2. So add a sleep:
while(1) { // this is the main loop
sleep_mode (); // wake in a predictable way
if (timer == 2) {
// timed code here....
shiftFwd(&H_GREEN_data[0]);
shiftFwd(&H_BLUE_data[0]);
timer=0;
}
In initialization, make sure sleep mode is idle:
set_sleep_mode (SLEEP_MODE_IDLE);
Hi guys, i have created a small game for Arduino UNO, using my VGAX library (https://github.com/smaffer/vgax). The game is called BIT NINJA and is a classic retro platform game like super mario bros. All the graphics and sounds are on flash (around 16k, for now). The gameplay is done using around 40 bytes of SRAM.
YouTube video:
(https://i.ytimg.com/vi/p34VCc_cLFI/hqdefault.jpg)
LINK (https://www.youtube.com/watch?v=p34VCc_cLFI)
Some of the code is taken from my program "maffiodo1" of the 23rd International Obfuscated C Code Contest (2014) (http://www.ioccc.org/years.html#2014) (program (http://www.ioccc.org/2014/maffiodo1/prog.c) screenshot1 (http://www.ioccc.org/2014/maffiodo1/screenshot-mario.png) screenshot2 (http://www.ioccc.org/2014/maffiodo1/screenshot-giana.png))
When the game will be finished i will publish the sourcecode online.
Happy hacking!
Has anybody tried using the VGAx Library on an Arduino Mega? what whould i consider? i tried using the same pins but couldnt make it work.
Thanks!
I have the color bar sketch working from Nick Gammon's tutorial at http://www.gammon.com.au/forum/?id=11608
I notice smaffer's schematic dropped the blue connection (pin 3 on the vga connector) and it's associated 470 ohm resistor. Was that on purpose? and why?
It is explained in the first post, but not in depth.
This offers 2 bits, so 4 colours (or states as you wish).
You have to decide what colours you choose, you could as well drop red or green to get an other set of colours.
One of these states is 00, no colour, so black.
You could also choose to have blue HIGH all the time, to get another extra palette.
00 would be blue.
01 would be purple.
10 would be cyan.
And 11 would be white.
The reason is storage; to get a reasonable resolution, just drop a third of the memory needed.
I can imagine it also saves some timing trouble, and it would help against the reported misalignment (chance of that would grow larger each added bit per pixel).
I am in the same situation as adgm1988, I attempted to run this on a Mega2650 using the same pins as the UNO and it didnt work. (tested with an uno, works ok so its not my dsub/resistor arrangement)
Are there any obvious reasons why it shouldnt work ? might it be something timer related ?
I'd like to run it on a 2560 ideally so I can use Rugged Circuits QuadRam 512kb SRAM expansion, I thought it might be quite promising.
update - I managed to get Nick Gammon's VGA demo to work on the Mega2560, I'm not sure what might be different in VGAx any help would be appreciated.
Did someone try to use I2C with this library?
Or will communicating via i2c break the VGA output?
The interrupt-handling required by I2C might throw out the VGA timings.
Off the back of Smaffers VGAX, I wrote a nice bit of code that drives a VGA monitor in 17bit colour
Works on a Nano (and UNO) and seems quite smooth
Here it is in one project decoding 250kbps data streams presenting as a bar graph
https://www.youtube.com/watch?v=IlkEMJtieXM (https://www.youtube.com/watch?v=IlkEMJtieXM)
Next UNO/VGA projects will involve a 16 input analogue voltage visualiser, colour spectrum analyser using FFT, and to finish the above youTube project with all its diagnostic DMX features
I absolutely LOVE driving video/TV/VGA from these little jiggers, for me it all started with the TVout library, then all Nicks investigations, AtomicZombie, and finally Smaffers code
I hope one day to post some really awesome projects, and show how sections of line handling can be driven using a really simple indexed array of vectors, which runs really fast (of which time is an absolute premium on VGA !)
I'm now using a $5 raspberry pi zero as the "graphics coprocessor" for the Arduino. Weird, I know ...
Hi. First I'd like to congratulate Smaffer for the library, is a very cool piece of soft, besize how useful it can be.
Despite the purpose itself was to show color on a VGA display, I would rather prefer having a bit more resolution. Let's say 160x90 pixels B&W, this is to keep the 16:9 panoramic proportion of nowadays displays. It would use 1800bytes of SRAM I think. Would there be any timing limitations.
Any clues?
sir can u please tell me how i can display a variable character . i m using vga.printPROGMEM function but it just work for constant character and i have to display a variable character , there is no function in vgax library for this ... i am trying to display a integer variable counter value of 100 or 1000 range
Do you mean a variable glyph? That is, you want a different font or something? Or do you mean you want to display, using the same font, a variable?
actually i just want to display a variable
Hello!
I like your VGAx library a lot
I made a little Stacker game with it
It uses only one button for control and has win/lose screens
Youtube video:
(https://i.ytimg.com/vi/5-d0RbQeefY/hqdefault.jpg?sqp=-oaymwEXCPYBEIoBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLC7xw8P1iNrpPbwzKmzGKz5j5rD7g)
(https://youtu.be/5-d0RbQeefY)
Btw
Are you going to release your BIT NINJA game's sketch some day?
It would very interesting to see how this game works
Hello to everyone!
i have released a new Arduino library to generate VGA signals from an ESP8266:
(https://github.com/smaffer/espvgax/raw/master/docs/splash.jpg)
(https://github.com/smaffer/espvgax/blob/master/docs/4.jpg?raw=true)
512x480px monocromatic with line coloring!
https://github.com/smaffer/espvgax (https://github.com/smaffer/espvgax)
This is the simple wiring needed:
(https://github.com/smaffer/espvgax/raw/master/docs/wiring.png)
Have fun!
Hello to everyone!
i have released a new Arduino library to generate VGA signals from an ESP8266:
512x480px monocromatic with line coloring!
Have fun!
Is....perfect!
Muchas gracias! ;)
Absolutely WOW Smaffer !!
What an amazing update from your great VGAX (which I studied alot !!)
Just one question.. Did you consider running the ESP32VGAX on the second core as a full time task, and running another application on the first core ? unless I missed it, this looks like it just runs in normal core mode
Regards Bob
Hello Bob,
thank you!
this version of the library is for ESP8266 (single core). I don't know if can run on ESP32 (dual core). I am planning to buy a dev board with ESP32 and, in the future, test if the library works
Hi again, sorry I completely missed the bit where you wrote ESP8266, and just naturally assumed you were going for the big guy !
I am doing some projects with ESP32 and just about to start with dual core (but not video yet, but maybe one day)
Regards
Hello!
I've released a new version of VGAX with ATMega2560 support. Resolution can be increased to 120x90px with squared pixels or 120x240px with rectangular pixels.
(https://i.ytimg.com/vi/Qs3uyhzUcfA/mqdefault.jpg)
Video example of 120x240px on Arduino MEGA :) https://www.youtube.com/watch?v=Qs3uyhzUcfA (https://www.youtube.com/watch?v=Qs3uyhzUcfA)
Have fun!!
Hi,
VGAXUA is now on GitHub! Is an alternative version of VGAX that use UART instead of bitbanging, inspired from the code of Nick Gammon.
The library support 192x80px on Arduino UNO and 200x240px on Arduino MEGA!
(https://raw.githubusercontent.com/smaffer/vgaxua/master/docs/vgaxua-screen-1.png)
https://github.com/smaffer/vgaxua (https://github.com/smaffer/vgaxua)
Can i display serial data (serial monitor)? And if is posible please send me code...
Thank you!!