Home 9 The Art of Technology 9 Creating the TV-50 : A Model TV Simulator

In case you didn’t know – I enjoy model building – specifically model railroading.  I have a website – Model-Rail Crafters where I sell the things I create.

I thought I would run through the process of creating a simulator. In this case – the TV-50 which uses one of the basic PIC10F322 boards I created, specifically designed for LED Effects.

A nice thing about having created a generic board – is that I have just one PCB to keep up with. This board I use on all my 50 numbered models.

I am not going to go through all the ins and outs of the board, nor the code.. Just the thought process that went on to create the products.

So, What is the TV-50? It is a simulator for a TV. It will simulator the flashing/dimming etc of a TV screen. It is designed to be placed inside a model house – to give the effect of somebody watching TV.

The first question I hear is why? Well because we want to add effects to our layouts to make them more real. Take them to the next level. Plus it adds uniqueness to the layout. It is what adds excitement when somebody is looking at your layout… OH WOW! It looks like a mini TV in that house. Look over here….

The Process

We already know what we want to do.. Simulate flashes of a TV Screen. 

How should it work – what does it look like? If you think about it, movies/shows are all some short clips (1 – 4) seconds in most cases of various brightness. Turn off the lights, turn on your TV, and close your eyes. You will be able to start seeing how the light behaves.

It can be, on/off – flicker – bright to dim, dim to bright. The beat or rhythm of the light flashes can change depending on program being watched.

Sometimes it can be some color.. but in this case I am just working with a single LED. Cool White.

Putting It Together

From the PIC10F322 I will use:

  • The interrupt function of TMR0 – as the timer.
  • PWM output – to control the brightness of the LED and to turn it on/off

50,000 feet high level overview:

  • Configure Device :
    • Set PIN Outputs
    • Set PWM for operations
    • Set TMR0 for operations
    • Configure Interrupt For TMR0
    • Seed Random Number Generator – Using ADC to read the internal Temperature Sensor.
    • Seed Count Variables with Random Numbers

Main Program:

  • Handle Interrupt – Increase Timer Counter
  • Check Timer Count – have we reached the Random value?
    • If so, assign 8bit random number to PWM Duty Cycle
    • Increase Change TV Program counter
    • Have we reached the Change TV Program Counter Value?
      • If So – choose a random ranged value and change TMR0 Prescaler Rate based on that number.
      • Reset Change TV Program counter to a random number
  • Rinse and Repeat

Of course there is more too it than that. But when everything is put together – the code uses 84% of the Program Space and 67% of the SRAM. Remember the PIC10F322 only has 512bytes of Program Space and 64 bytes of RAM.


Have a Project or Idea!?

I am Available for Freelance Projects

I’m always ready to take on new opportunities and eager to connect with like-minded people.

If you’re interested in working together, connecting, or just having a good conversation, send me an email. I look forward to hearing from you!

jamie@jamiestarling.com


Pin It on Pinterest

Share This