Video generation on tiny85 with VUSB

Hi,

Please prepare yourself to a quite long story.

I used to install VSAT systems using handheld satellite spectrum analyzers (SSA), and one of the models which got my attention is Unaohm EP-300, it’s based on B&W analog TV with Internal OSD (On Screen Display) and spectrum analyzer interface (I think), have a look at it in this link:

I had experience with PIC and already made my own handheld SSA with GLCD, but the Idea of cloning even a basic version EP-300 is living inside my head :astonished: .

I had couple of tiny85 doing nothing and I like the AVR learning so the first step was to load tiny85 with VUSB boot loader based on instructions from here:

http://anuduino.os-hardware.in/data/html_book/chapter_2.html

And here:

The IDE recognized the board and I was able to load some examples successfully :slight_smile: .

Next was the TVout library, but all of my attempts to compile it for tiny85 went unsuccessful, too many errors, too much time spend, then I found this link:

http://www.javiervalcarce.eu/wiki/TV_Video_Signal_Generator_with_Arduino

I used that project with some modifications to timing and lines setup, and it worked.

To make life easier, I divided the project into three parts, the first was to generate flat screen with two black edges and the horizontal lines in between may switch from black to white depending on set value of variable named (X), which went well (see attached pictures showing several levels of X), then the second part is to simulate the change of sat tuner base-band level using pot, then the third part to control the sat tuner using I2C .

Next was to change the value of variable (X) using pot connected to PB2, the problem started here, when enable the code to set (X) from analogRead the sync will go crazy like been multiplied several times (picture attached), I searched a lot but so far I am unable to understand why sync is multiplied, if any of you guys have a clue please jump in, attached the INO file for reference (code seems to be too long to fit within 9000 characters limit for this message !).

Your advice is much appreciated.

Thanks

Katada

TVout_on_tiny85_-_under_test.ino (9.93 KB)

I wonder, is this topic too complicated to have some opinions ?, or its just out of interest level ! ::slight_smile:

Anyway, thanks for nothing.

Next was to change the value of variable (X) using pot connected to PB2, the problem started here, when enable the code to set (X) from analogRead the sync will go crazy like been multiplied several times (picture attached), I searched a lot but so far I am unable to understand why sync is multiplied, if any of you guys have a clue please jump in, attached the INO file for reference (code seems to be too long to fit within 9000 characters limit for this message !).

Analogue read takes a long time to complete (see here) and is blocking so will screw with your core programs timings. It is possible to program the ADC hardware directly so it returns results quicker but you best option might be to set it into a different mode so you start an ADC reading and then continue with your code. When the ADC result is ready it can either generate an interrupt or you could poll the ADIF flag when convenient in your code loop.
I guess your maybe going to move to a different MCU as this is all getting a bit much for a tiny85 (5 pins used without I2C) and I2C is not so easy on the tiny.

Hi Riva,

Thank you for your input.

It is possible to program the ADC hardware directly so it returns results quicker

I will try that.

(5 pins used without I2C)

Planning to wipe the VUSB and use the two pins for I2C later on, using Arduino as a programmer.

I guess your maybe going to move to a different MCU

If I can’t make it with tiny/mega , then it’s a dead end.

Katada

The tiny85 does not directly support I2C but uses a Universal Serial Interface (USI). You may find using USI will also mess with your timings but maybe you could turn off the display output while using it (assuming short bursts of data).

I had mentioned a different MCU because of the pin count but either using a slightly bigger AVR or re-tasking the USB pins would probably do it.

firstly, I think you really need to be running your syncs from an interrupt
Secondly, are you using a crystal or the internal resonator ?
The internal resonator may not be able to create a stable enough frequency to create a good sync

I have done many projects involving TV PAL signals

just as a start, look here MADNESS: AtTiny13a VGA driver - 40*40 pixels in 8 colours - Displays - Arduino Forum

Personally, I would do all the video processing in an interrupt, possibly one for VSYNC and another for HSYNC & line rendering and do all your analog reads in main (outside the interrupt)

going one step further, it is possible to do many colours and lots of processing using a slightly bigger processor and in VGA mode to drive a standard monitor

see here : Arduino AVR UNO Nano : DMX512 Data to VGA Data Display - YouTube

Hi mcnobby,

Thank you for the reply, since I am still learning AVR I may take some time
to feedback.

BTW, very nice work you did with ATtiny13a.

Katada

Katada, since I started playing with AVRs, TV & Monitors a few years back I have been addicted to it, so much fun creating patterns and colours from such small underpowered devices. People keep telling me to get a 32bit processor to do all the work, but I like to get as much as I can out of an 8bit device (ATTiny or ATMega)

It is likely that if you want to do anything special with a good resolution, you may have to consider coding in assembler as well as C

Thank you, and keep up the good work

Bob