Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Almost complete newbie, almost completely broke, where do I start?

Status
Not open for further replies.

Roger Harris

New Member
Hi all,

The title says it all, really.

I want to learn how to program Microcontrollers in the most economic way possible.

I have a specific purpose in mind (at least, at first I do - knowing me I'll get distracted into all sorts of other avenues).

I'm building a home simulator cockpit, to interface with Microsoft Flight Simulator 2004 and FSX.

I want to drive 7-segment LCDs, taking values from the Sim probably using Pete Dowson's fantastic interface FSUIPC and programming in Visual Basic (because I don't know C++).

I have almost no money, so I'm very heavily in the DIY bracket, using a 7 year old laptop I got off a mate and Win XP.

If you're wondering how I can build such a thing when I'm broke, then you've never found a local source of pallets, old cardboard boxes, and haven't heard of Freecycle! Everything in the Sim, screens, computers, structure etc. has been garnered from such sites and has cost very little. No more than £20 spent so far - and that's on petrol!

Anyway I digress. As usual.

So I have a very basic understanding of programming such as do-loops and if/then/else statements, subroutines and the like. I have had a dabble in PIC programming some years ago.

What would be the best way to start?

many thanks,

Roger.
 
Sounds like an arduino clone situation since you won't need a uC programmer and only rudimentary programming skills are essential.
 
"Arduino clone".. what?
 
Ah...another Flight Sim junkie! Awesome! If you fly on VATSIM, I fly for Pacific World Airways VA. Look for callsign PWA1504...that's me.

I've been a PIC programmer for awhile now, and I actually wanted to build my own hardware FMC with a USB interface to work with vasFMC for the Project Airbus A320. Haven't even started on it yet, but that's what got me into advancing to the PIC18F series of PIC microcontrollers. The 18F45K50 has an on-chip USB port to handle the USB communications. Still need to get some sort of a graphic LCD or TFT screen and figure out a way to make an FMC keypad for it as well.

To start, I would consider purchasing the PICkit3 Debug Express kit from microchipDirect. They sell them for $70 USD and it comes with the PICkit3 programmer and an 18F45K20 development board to get your feet wet in writing working programs. Microchip's IDE software for writing code and programming the PIC is free and downloadable from Microchip's website. This kit will at least get you started in the world of programming PIC's.

18F PIC microcontrollers are optimized for C language, and Microchip's XC8 compiler is also free. The free version of the compiler doesn't offer code size optimization but this should be of little concern. You can also code them in Microchip assembly if you so desire, but as complex as the 18F PIC's can be most prefer to code them in C.

Here's a link to the kit -

https://www.microchipdirect.com/ProductSearch.aspx?keywords=DV164131

Once you have your feet wet in programming PIC's, you can then purchase a breadboard for testing your designs along with other PIC's as the PICkit3 is compatible with most of the PIC processors in Microchip's catalog. So you're not just limited to the demo board that comes with the kit. Anything you plan to build for interfacing with FS9 or FSX you would ideally want to have a USB interface so I would also look into learning the 18F45K50 processor as it has the USB port on chip (you'll need a USB connector or breakout board to tie into the chip to use the USB) and Microchip also has a USB stack/library for the USB port, which is also a free download. You can find the USB breakout board complete with connector from SparkFun Electronics here -

https://www.sparkfun.com/products/9966
 
Last edited:
As much as I love PIC controllers, a cheaper solution might be a small STM8S eval/ dev kit from ST. They are available from loads of places, RS, Farnell, Mouser, Digikey etc, are extremely cheap and provide you with a programming and debugging environment right on the breakout boards as well as allowing you to separate them for inclusion in your projects and add additional functionality on a wee prototyping area if needed etc. Software development tools are free and there is loads of example code around to get you going. Have a look at this little overview and see what you think...


I have used these in the past and they have proven to be a real quick and dirty solution for small control projects :)
 
Why don't you just join the US Navy, I've heard they have the second largest air force in the worlde.. after US Air Force..
 
Thanks for the replies everyone.

Funds being so tight, the STM8S looks interesting - can I run a 7-segment display off this - or can I run more than one?

As I remember, multiplexing 7-segment LEDs involves sending the same digit to all of them, but only connecting the cathode (or anode depending whether they're common cathode or common anode) of the actual digit you want to light up. This is done alternately to each display, and so quickly that all of the 7 segment displays seem lit at the same time.

So to light, say, 15 different displays, I'd need 8 outputs (7 segments plus the decimal point) for the LEDS and 15 more of the common anodes/cathodes. If the STM8S has 8 outputs, I could run 8 displays with two of them - correct?

The PICkit3 looks great, but I don't have £30-odd at the moment. However, if I need three STM8S's to do the same job, it might be better.

Lastly, is it possible to build one of these boards onesself? Or an Arduino, self-built?

I tried to join the British Navy 40 years ago to fly jets off carriers. That's when I discovered I was short-sighted and asthmatic... ;-)
 
I often break down small control projects to a modular level. While it may be great to roll your own display, for a one off, I might well consider using a pre-built display module that uses a serial bit stream. Not only does it save on i/o, but it is likely mounted remotely from the main controller anyway and having a serial interface minimises your wiring. As a bonus, that approach also gives you the option of tacking other functionality onto the same serial link either now or at a later date. Have a look at some of the TM1640 device based displays, these can drive up to 16 digits as I remember, however there are other great devices and modules out there that are inexpensive :)
 
Or you can use two 74HC138 3 to 8 decoders for your anode transistor drive. These have 3 inputs and 8 outputs, and the 8 outputs drive low sequentially when writing a binary value from 0-7 to the 3 inputs. This would allow you to drive up to 16 anode transistors from just 6 I/O pins on the micro + 8 I/O for the parallel segment bus. With some multiplexing trickery using the OE pins on the 74HC138, you can bus the inputs on both chips, then use a 4th pin for the OE pins on both chips so that only 4 pins will be required for anode drive. I'll draw up a schematic and post.

I'm also in favor of dedicating a separate micro for the LED segment drive. You can use the serial port on this micro for the main micro to send the characters to it.
 
Forget about doing your own multiplexing, use a MAX7219 or better, MAX7221 - though Maxim have replaced these chips now, they are still widely available and cheap. Dead easy to interface, even I could do it.

Sounds like an awesome rig you are building - having almost no money myself for a long time, I'm a big reclaim fan :D
 
If you really want cheap and easy and go with theses **broken link removed** $1.99 each. Your going to need more then one of what ever you use. If you want this to look and feel real time I don't see one micro handling all the controls the leds video and you flying at the same time. You'll need something fast for the video of the plane flying and a hand full of micro's telling the main brain what your doing
 
Or you can use two 74HC138 3 to 8 decoders for your anode transistor drive... (snip) .
I'm looking forward to studying that schematic, Jon. Also, I like your tutorials. You going to do one about using interrupts? Please :)
 
Or you can use two 74HC138 3 to 8 decoders for your anode transistor drive... (snip)
I'd like to see that too, Jon. I'm concerned though about the brightness levels resulting from a 1/15th duty cycle.

Here's a scheme I've used in the past (below) that yields a nice 1/4th (25%) duty cycle with PWM brightness control using 5 pins (when you ignore that 5th column).

Regards, Mike

MacMux #2.png
 
I'm looking forward to studying that schematic, Jon. Also, I like your tutorials. You going to do one about using interrupts? Please :)

Sure! Been meaning to do one on interrupts. They're super simple.

Mike, after seeing your schematic I'm gonna decline on doing one. Your idea is loads better and can easily be coded using a timer interrupt. The only thing I would change is to add PNP transistors for the anode drive on RC0-RC4. Even though the average current can be sourced via the I/O pins on the PIC, I'm not a fan of doing final load drive directly from the microcontroller.
 
Sure! Been meaning to do one on interrupts. They're super simple.

Mike, after seeing your schematic I'm gonna decline on doing one. Your idea is loads better and can easily be coded using a timer interrupt. The only thing I would change is to add PNP transistors for the anode drive on RC0-RC4. Even though the average current can be sourced via the I/O pins on the PIC, I'm not a fan of doing final load drive directly from the microcontroller.

Those little red things are the pnp (p-channel) drivers.

Gosh, I'd really like to see your method. It sounds like a pretty neat idea and shouldn't require nearly as many chips as the method I mentioned.

Regards, Mike
 
Last edited:
Well if you still wanna see it then I suppose I'll draw it up.
 
Well if you still wanna see it then I suppose I'll draw it up.
Yes, please. I've been trying to figure it out and this is what I have so far;

Jon's Digit Select Logic.jpg

Please tell me if this is correct. You're using each active low 74HC138 output to drive the base of each PNP column/digit driver and I think you said you're using direct drive from the PIC for the cathode segments. Twelve I/O pins, two ICs, and fifteen PNP transistors. Yes, no?

You know, if you add a 74HC595 or TPIC6C595 IC to drive the display segments, you could drive the '595 output enable + latch pins using a PWM signal from the PIC and borrow two of the four column/digit select lines to load the '595 during a short 3-4 usec blanking interval at the beginning of each display refresh cycle. That's five I/O pins, three ICs, fifteen PNP transistors, and PWM brightness control.

I suppose you could also use a couple 74HC595's for the PNP column/digit drivers and a TPIC6C595 or similar sinking driver for the segments and get it down to three I/O pins.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top