Geoff Bunza geoffb

Model animation—bringing models to life—adds enormously to the interest and enjoyment of any layout or individual model!  Recently a fellow modeler (Rick Wade https://forum.mrhmag.com/post/my-operating-ho-scale-tv-on-my-richlawn-rr-layout-12199201) dreamed about building a working HO scale TV—and I wondered—is that possible?  Then I found Harry’s TV shop and stopped wondering…

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 2
Tjan70

W/B TV

Hi, Geoff.

 

Here is a video with B/W pictures and with 2 TV's.
 

Best regards,
Sebastjan

My Home Page:   http://potepanja.eu/modelarstvo/

Reply 0
Geoff Bunza geoffb

@Sebastjan re: TV's

Hi Sebastjan,

Wonderful, now you need more "video" for  the second TV screen!

 

Have fun! 

Best regards,

Geoff

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
ILHO

Adafruit code


Animation
One is by using a higher power processor and inline code
https://learn.adafruit.com/animated-electronic-eyes-using-teensy-3-1


this one is simpler in that it scrolls rather than really doing animation
but it still uses  and inline code to achieve that.
https://learn.adafruit.com/scrolling-mario-clouds-tft-jewelry

 

Both explain that this is the 'wrong' way to do things and that it only works for these processors... these days with computers on a chip you could hook up a Raspberry Pi and actually show video.. tho the cost is much more than a $2 arduino.

Thanks Geoff for all you do.

Ivan

Ivan Lee Herring

Mountain Valley Western

Reply 0
fkowalick

Harry's TV

I would like to try to build a similar scene for my layout, but I don't know if I have an existing structure that would house the electronics.  Can you tell me what structure kit was used for Harry's?

Fred

Reply 0
Geoff Bunza geoffb

Harry's Building

Hi fkowalick  (name?),

The building base is 2.75 by 4.94 inches. The basic bulding is Rix Products Smalltown USA Tobacco Shop 699-6014, with the front window from Rix Products Smalltown USA Tonys Gym 699-6002:

699-6014.jpg        699-6002.jpg 

Rix Tobacco Shop 699-6014                                          Rix Tonys Gym 699-6002

I also cut out and moved the doors forward. All this was done to maximize the window area for TV viewing and make it easier to mount the display board. Design Preservation models also has similarly sized structures, and wall panels that can make adaptation easy.

You can see from this picture:

deHarrys.JPG 

that there are 3 pieces that form the controller from left to right): the Arduino Pro Mini, the SD memory card reader (both mounted on a small piece of perf board just to hold things together), and the tiny 0.96 inch color display mounted vertically on the right edge (in the left front window). The first floor can be divided into a front and back room and each piece is placed in one of the rooms. In my case, I wanted random lighting in each of the rooms on the second floor (divided side to side not front to back as on the first floor), so a floor of black styrene pastic and walls were added.

The 9 volt battery powered the unit for about 1-2 hours, mounted on the outside rear wall. On a layout I would recommend a 6-12 DC power supply or a wall wort AC adapter, depending on you needs and availability.

Have fun! 
Best regards,
Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
fkowalick

Sketch for Harry's

When I tried to upload the sketch I received the error message:  #include "glcdfont.c" and the compiler stops.  This comes from the Adafruit_GFX library.  Not being that knowledgable about Arduino I am not certain how to proceed to upload the sketch to my Pro Mini.

Fred

Reply 0
Jim at BSME

Compile problem

I think Geoff is away for a couple weeks, so I'll try and help.  I think the problem is you forgot to copy the library files to arduino library directory/folder.

In the zip file HarrysTV, you should have four directories/folders: Adafruit_GFX, OLED_SSD1332, OLEDColor4_edit4, and Video. The two folders Adafruit_GFX, and OLED_SSD1332 need to be moved/copied to the Arduino IDE's libraries folder.  The default location for the folder on windows is: install-path\arduino-n.n.n\libraries.  I did this and successfully compiled with version 1.6.12 of the Arudino IDE.

EDIT: changed default location from My Documents to the installed arduino IDE path, note n.n.n is replaced with the arduino IDE version numbers. 

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

Compile problem

In fact I did copy the two folders into the Arduino's IDE libraries folder. Yet when I tried to compile the sketch I get the error referred to above, but that line #include "glcd.font.c" is one of the instructions in the Adafruit_GFX library.  I do not know if the compiler is trying to tell me the instruction is no longer valid or what?

Fred

Reply 0
Pelsea

#include error

This probably means the glcdfont.c file is missing or damaged in your installation. It's a part of the Arduino installation, not Geoff's code. Make sure you have the latest ide. You can find a copy of the file here.

pqe

Temporarily inactive due to annoying but non life threatening medical issues.
Reply 0
Jim at BSME

#include error

@pqe, yes and no.  Geoff provides the library Adafruit_GFX in his zipfile which has the glcdfont.c file, so no it is not part of Geoff's code, but yes he does provide the library with all the files.

I downloaded  HarrysTV.zip today from the link at the beginning of this thread and moved the two libraries from the zip file location to the Arduino IDE's library folders and successfully complied the code.

@flowalick, check to make there is not an extra folder in the path to the file, it should be at:

 install-path\arduino-1.6.12\libraries\Adafruit_GFX\glcdfont.c

and not:  install-path\arduino-1.6.12\libraries\HarrysTV\Adafruit_GFX\glcdfont.c or something else.

The number in the above paths may be different, depending on the version of the IDE you have installed.

One other way to check that the library is installed, in the Arduino IDE bring up the menu item Sketch -> Include Library and see if the Adafruit_GFX library is listed under Contributed libraries, at least with version 1.6.12

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

Compile problem

I got the sketch to compile only to find my computer will not upload it to the pro mini.  I am using Windows 10 and am consistently receiving the message from Arduino "can't open the device, the system cannot find the file specified."  Windows is giving me the message "device descriptor request failed."  I don't know if the usb cable is bad, the pro mini is bad or something else is going on I am unaware of.  Any suggestions?

Fred

Reply 0
Jim at BSME

Next step - uploading to pro mini

Hey first I would like you, if you don't mind, to share your first name or a nickname, instead of referring to you by your username. BTW: you can create a signature, could just be your first name, and any other information you would like to share (e.g. your model railroads name, club you belong to, etc). To create a signature go to the My account item from the menu items on the top right and click edit on the My account page, scroll down and fill in the signature block.

To help others was the compile problem an extra folder in the path or something else?

Ok on to your windows 10 / arduino uploading problem, sounds like either a driver problem or a setting it the IDE.

So we will check the driver issue first. Sorry I don't have windows 10 here at work, so I can't take snapshots to include, but the process is fairly straight forward. You don't need the arduino connected to the USB cable, just the USB cable to the computer.

Lets check if the USB cable device is found and ok or not. Click in the search box next to the windows start button and enter Device Manager, select the one with the words control panel under it, should be at the top of the list.  Fist look for an Other devices entry, and see if it has an entry for your USB cable, something with USB to UART in the words next to an entry. If you find it here, it will likely have a yellow triangle with an exclamation mark in it, meaning there is a problem with the device, likely the driver didn't load automatically. Right-click on the entry, and select Update Driver Software. Select Search automatically for updated driver software. If windows is unable to find the device driver (which was the issue I had) we will have to determine which USB to UART chip you have to find the correct driver. Hopefully it is as simple as reading the rest of the line, which was the case for me, mine is a CP2102, so I googled for "windows 10 cp2102 driver" and found the driver from the manufacture Silicon Labs, downloaded the setup file and installed the driver and everything was good.

If you didn't find your device under Other devices, check under Ports (COM & LPT), which is where my device showed up after I installed the driver. You can select update driver here as above and see if there are any updates for the device driver. I wouldn't worry about going to the manufacture's site if windows doesn't find any updates here, as long as you don't have the yellow triangle with the exclamation mark you should be ok. If it does have the triangle, find a driver as above and install it.

You will need the com port number from this entry to use in the Arduino IDE.

If you got this far and everything looks good under Ports (COM & LPT) then take note of the com port entry for the USB to UART cable, mine was COM3. You need to select this in the Ardunio IDE under the Tools -> Port menu entry.  Now connect you ardunio and try the upload.

One other thing when looking for the driver you will need to know whether you have a 64-bit or 32-bit version of windows, check this by:

Go to Start, enter About your PC and then select About your PC. Look under PC System type to see if you're running a 32-bit or 64-bit version of Windows.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

uploading to pro mini

Thank you for all your assistance.  I am more of a model builder than an electronics person, but I am trying to add some animation to my layout.  I successfully installed a Light Genie, but this has me stumped.

I solved the compiling problem by reinstalling the IDE and the libraries.  Apparently on my first installation I somehow imported the Adafruit_GFX library twice.

My USB cable checks out ok.  It appears in the device manager as working properly and using com port 3.  Under tools ports shows com port 3.  One thing I don't understand is that in tools, under ports, it shows com port 3 and does not allow any changes.  So if the USB cable was using a different port I have no idea how to tell the IDE what port is being used.

Nevertheless, after the sketch is compiled I get the error message:  "Problem uploading to board."  It then refers to the troubleshooting guide for suggestions.  I have read the various suggestions offered but none seem to solve the problem.  I suspect I may have just gotten a bad pro mini.  When connected to my computer the red led is on constant and the green led flashes, but it won't upload the sketch.

Fred

Reply 0
Jim at BSME

uploading

Fred,

There are a couple other settings in the IDE to make sure everything is set to upload to the board. First to answer your com port, only com ports that are available to select are listed in the port selection. So even though the com port number assigned to the USB cable is COM3, there may not be a COM1 or COM2 available, if there were they would be listed as well.

From the tools menu make sure that there is a check mark next to the COM3 in the list, even though that is only port it still has to be selected. Also the board type has to be set to Arduino Pro or Pro Mini, and check that the Processor defaulted to ATmega328 (5V, 16 MHz) and the Programmer to AVRISP mkII, I cut and pasted the section of the tools menu below with the correct values, you should have this when everything is selected correctly.

HarrysTV.png 

If after setting to these values it still doesn't upload could be the connection between the USB adapter and Pro Mini, some pinouts are different. As you mentioned the LEDs are on on the Pro mini, that means at least the power and ground connections are correct and likely the Pro-mini is good. When attempting to upload the LED that is flashing should go out and flash once at the end of the upload. At least that is how it behaves on my pro mini.

I would look at the labels on the Pro-mini and the USB adapter, if you are lucky and they are the same you should match up all except TX/RX they should be crossed that is RX on one end goes to TX on the other. There will be an additional letter after the TX and RX, but don't worry about that. If your cable doesn't look like it has labels, please post a picture or a link to the place you purchased it from and will see if we can figure that out.

Or your Pro Mini has one of the other processors, which you should able to check by using a magnifying glass to read the part number on the chip.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

Uploading

When I attempted to upload the sketch the values were as you stated.  In tools Com 3 was checked, the board was listed a Pro Mini, the processor ATmega328 (5V, 16MHz) and programmer AVRISP mkll.  I purchased the USB cable from an Ebay supplier and it was described as a 6 pin FTDI FT232RL USB to Serial modu USB to TTL RS232 Arduino Cable M377.  I was somewhat dismayed when I received it to find that the connector on the end of the cable could not be plugged directly in to pins on the board because the arrangement of the wires was red, black, white, green, yellow, blue, consequently the wires would not match up with the VCC and ground connections if it was plugged into pins on the board.  However, information that was listed with the cable gave the wire connections as Red:  5V, Black: GND, White:  RXD, Green: TXD, Yellow: RTS and Blue: CTS and that is the way I connected it,  however, I now wonder if I should have connected the white wire to TX and the green wire to RX.

When the USB cable is connected to the computer the device manager says it is working properly and is Com 3.  I discovered, however, that if I connect the cable to the Pro Mini before connecting the USB cable to the computer I get the message that the device descriptor request failed, code 43.  Therefore, the order in which I connect the respective devices to the computer makes a difference.

When I try to upload the sketch the green led never goes out, it remains flashing.

 

 

Fred

Reply 0
Jim at BSME

Hmmm

Fred,

I'll try it when I get home, but I don't think it matters for me whether the Pro Mini is plugged in to my cable or not, but I have a different adapter, mine is the Silicon Labs CP2102, yours is the FTDI FT2323RL.

First I'll give you bad news, you could have a fake FTDI chip that the driver provided by windows update and FTDI will break and not let it function (aka brick it). 

Now for the good news, the chip can be un-bricked, but from my belief since it shows up correctly in the device manager you probably have a good real FTDI produced chip.

So lets go with the pin order problem as the most likely culprit, pro-mini from different sources seem to label their pins differently, and one I have found reversed the order of the pins!  Obviously the red +5 (VCC) wire is correct, the black ground wire might off by a pin, read on to check.  The yellow wire (RTS from the cable end) needs to go to DTR also labeled GRN in my small sample, this will be a pin on the corner and in my review of pictures is always next to the Transmit (TX) pin. The transmit pin on the pro mini is labeled TXD or TXO and should connect to the green TXD wire from your cable.  The receive pin on the pro mini is labeled RXD or RXI and should connect to the white RXD wire from the cable.  The blue CTS wire should connect to the last pin on the other corner labeled either GND or BLK, if you have your black wire connected here, just move it up one pin next to the red wire, the last two pins on the pro mini are actually both connected to ground and may both be labeled GND.

From your description of what you see when it tries to download I'm thinking the the blue and yellow wires are reversed. If this cable order doesn't work it will not hurt anything to switch the RX and TX pins/wires.

Hope this gets you TV working, once this is sorted out you can program all sorts of animation into the pro mini.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

uploading to pro mini

Other than having flip flopped the black and blue wires I have the connections to the pro mini wired as you describe.  I corrected the black and blue connections, but when I tried to upload the sketch I again got the unspecified error "problem uploading to board."    I then tried reconnecting the white and green wires, the white to TXD and the green to RXD, but when I tried to upload the sketch I received the error message "Avrdude:  ser_open():  can't open device "\\.\Com3":  access is denied."  The board I bought does reverse the order of pins, however, they are clearly marked, albeit on the bottom side of the board, not the component side as is shown in most illustrations I have seen of the Pro Mini.

I inspected the chip on the board and it says "Atmel Mega 328P AU 1516."

In device manager windows recognizes the USB cable  as Universal Serial Bus Controller, mfg FTDI, and working properly.  It shows the driver as version 2.12.16.0, dated 3/9/2016 and says the driver is up to date.  If the cable I purchased has a fake chip in it how can I tell?  I was a little bit leery when I saw how the wires were arranged in the connector.  Almost everything I have seen about Arduino says to plug the connector into the end of the board with the black wire to the BKL/GND on one end and the other to the GRN/DTR.  Obviously I could not do that with my cable because one of the end wires was the red 5 V+ wire, not the black ground.  The next wire, inorder, was the black ground wire.

Fred

Reply 0
Jim at BSME

Troubleshooting

Fred,

Well I think because windows sees the USB cable as the FTDI cable and says it is working properly I think you are ok with the cable it is just the mater of getting the pins connected correctly.

I will also attempt to find a FTDI cable, but that may take a couple days so I can better help with troubleshooting your problem.

My CP2102 USB adapter I do have the RX and TX crossed, meaning RX on the adapter goes to TX on the pro mini and TX on the adapter goes to RX on the pro mini. I find it strange that crossing those two yields the result of can't open device - access denied as all switching the RX and TX should do is affect how the adapter talks to the pro mini, the com port access is for connecting from the computer to the adapter.  There are only so many combinations of the pins.  The blk/blu switch really doesn't matter since both those last two pins are connected to ground.  I would try swapping the blue and yellow wires and try the RX/TX in both combinations, straight through and crossed to see if any combo works.

The other thing to try is to use the old driver included with the arduino software, without having a FTDI based adapter I can't test the steps to the procedure.  I would select Update Driver, then select Browse for driver software on your computer, and browse to the arduino install folder\drivers\FTDI USB drivers and select the driver there.  Problem is I don't know if it will let you use the older driver or not.  If not you could uninstall the driver, remove and reinsert the USB adapter and instead of letting windows automatically install the driver, install from the Arduino drivers directory.

Hopefully one of the above will solve your problem, I will try and locate an FTDI cable so I can give better troubleshooting steps.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

Troubleshooting

Jim,

I have tried every permutation of connection to the pro mini I can think of and am still not able to upload the sketch.  I always get one of three messages:  1) problem uploading to board, 2) programmer not responding, or 3) the latest, can't communicate with device.  I've read so many posts on so many forums I'm going blind.  A number of them talk of the drivers, yet when I plug the USB cable into my computer device manager always says the device is working properly and when I try to update the drivers it says I have the latest drivers.  I think it is significant, however, that device manager only responds favorably when I plug the USB cable into the computer first and the the pro mini into the cable.  If I connect the pro mini to the cable and the plug the cable into the computer I get either one of two messages:  1) windows has determined the device has malfunctioned (code 43) or 2) device cannot start (code 10).

I have read so many posts by people who have had trouble uploading to the pro mini I'm beginning to think that successfully uploading a sketch is the exception, not the rule.

Fred

Reply 0
Brent Ciccone Brentglen

Bad cable

I suspect it is your fading cable that is bad. I bought one that didn't work from eBay, had to get an authentic one from sparkfun. Seems to me that I saw similar error messages...

Brent Ciccone

Calgary

Reply 0
pierre52

@Fred

I can understand your frustration and I can see why you would think that successful upload of a sketch would appear to be the exception. 

However, so long as the necessary steps are followed and the equipment is serviceable then successful uploads should be the rule. The advice you have received so far has been excellent and has covered the playing field.

Like most endeavours there are some basic rules that must be followed and so long as these are adhered to, troubleshooting problems should be a bit easier. In my limited experience, I have learnt to follow the following steps:

1. Verify the sketch. If the sketch verifies then you know the syntax is correct. If it doesn't then there is little point in attempting to upload it.

2. Under Tools - Board, check that you have the correct board identified and selected.

3. Under Tools - Port, check that you have the correct Port selected.

if these 3 steps are followed and the equipment is OK then the sketch should upload correctly every time.

Given that you have been through these several times, then I would concur that your USB cord is the most likely culprit. I would also endorse purchasing a replacement chord from one of the major retailers

Peter

The Redwood Sub

Reply 0
Yaron Bandell ybandell

FTDI knock offs

I also believe that with some FTDI knock offs after driver version 2.10 it would recognize the programmer but simply refuse to upload sketches. Some versions after 2.10 even bricked the knock offs. Worst case, get a new one from Sparkfun directly, might be a bit more expensive, but you know you'll receive a genuine one. And the cable replacement suggestion is not a bad thing either. I've had usb cables from (Motorola) cellphones that acted weird when using them with other USB devices in the past.
Reply 0
fkowalick

Tests

Before I invest in a new cable what tests can I perform to determine whether the problem is in the cable or with the pro mini itself?  I did discover this morning that the when I connected a new 9 volt battery to the raw and ground connections it did not turn on, even though it does power on when connected to the usb cable.  Obviously that is a sign that something is not right with the pro mini, but I do not know if that would affect its ability to upload a sketch.

Fred

Reply 0
Jim at BSME

RE: tests

Fred, been searching for an answer, you might be able to do a loopback test of the adapter.  I have not located an FTDI USB-Serial convertor to borrow yet for testing myself, will check at work Monday.

Of course nothing is simple with windows 10, apparently they don't include a terminal program, so you will have to download one and install that first. I recommend putty, which you can download here:  https://the.earth.li/~sgtatham/putty/latest/x86/putty-0.67-installer.msi, this will allow you to connect to the serial port.

To have the adapter cable loopback on itself, take a piece of wire and connect the RX and TX pins, should not matter whether the cable is plugged into the computer first or not. Next startup the putty app and select Serial, COM3, 9600 speed and open.  A terminal window will open that if you type into you should see the characters you type and nothing else.  If you see the words "NON GENUINE DEVICE FOUND" in the window then you know you have the fake FTDI chip in your adapter cable.

If there is a way to back date the driver to the one provided with the Arduino installation, it will not put in these extra characters that may be confusing the Arduino loader. Of course windows 10 may automatically update the driver to the latest, creating the problem again.  If you don't get the "NON GENUINE DEVICE FOUND", then it must be a problem with the pro-mini, since you already tried the different pinout combinations.

One question are you programing the pro-mini plugged into all the extra pieces or is the pro mini by itself?  I would have it disconnected from all the extra pieces in case a wiring error is causing an issue.

- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
fkowalick

Tests

Jim, thank you.  I will try the test you suggest.  When I first tried to upload the program I had all of the components connected.  After my first futile attempt to upload the sketch I read in Arduinos troubleshooting guide to try programming the pro mini with no other devices connected so I disconnected the SD card reader and display, about a week ago.  One thing I noticed, however, is that when I had all the components assembled I powered the pro mini from a 9 volt battery, connected + to the raw terminal and - to ground and it powered up with the red LED on constantly and the green LED flashing.  When I first tried to upload the sketch I disconnected the battery and connected the cable and it powered up with the red LED on constantly and the green LED flashing.  Since  I have been trying to upload the sketch it will no longer power up from the battery.  I am not sure why, having connected the cable to program the pro mini, and having made many attempts to upload, it will no longer accept power from the battery.  

 

 

Fred

Reply 0
Reply