Battleship processor in 8 pins!

Ask and answer questions, share tips and resources for installing lighting and other electronics in your models.

Moderators: Sparky, Moderators

Post Reply
Madman Lighting
Posts: 1816
Joined: Sat Mar 05, 2005 9:16 am
Location: Serenity.
Contact:

Battleship processor in 8 pins!

Post by Madman Lighting »

I'm researching what I can get for my next product and how I can do it most economically (ie: CHEAPEST) and you know what? I found a couple of 8-bit microprocessors for less than a buck each, in singles! Damn things have more ram than my buddies old TRS-80 and run faster too. What does this mean for my products?

It means its actually cheaper to put a microprocessor with 4K of Flash memory on board and program it in C than it is to use dedicated logic like a 555 or 4060. Go figure!

-John C.
That Madman Who Lit Up Deep Space Nine
macfrank
Posts: 8726
Joined: Fri Oct 11, 2002 6:55 pm
Location: Los Angeles, CA
Contact:

Re: Battleship processor in 8 pins!

Post by macfrank »

Madman Lighting wrote:I'm researching what I can get for my next product and how I can do it most economically (ie: CHEAPEST) and you know what? I found a couple of 8-bit microprocessors for less than a buck each, in singles! Damn things have more ram than my buddies old TRS-80 and run faster too. What does this mean for my products?

It means its actually cheaper to put a microprocessor with 4K of Flash memory on board and program it in C than it is to use dedicated logic like a 555 or 4060. Go figure!

-John C.
I enjoy programming the Atmel AVR processors. Digikey has pretty much the full line. From an assembly language point of view, they're easy to understand (not as quirky as the PIC series) and Atmel has an excellent, free assembly language editor/downloader. The development system is fairly cheap, too ($79).

There's an also an excellent, free version of the Gnu C compiler for the PC called WinAVR.

I'm currently finishing up a project with the $20 AVR Butterfly. It's going to be a very basic solar powered temperature/light/voltage datalogger (in its first version) that I'm going to drop off in the Mojave next weekend, and leave there until October.

Frank
Madman Lighting
Posts: 1816
Joined: Sat Mar 05, 2005 9:16 am
Location: Serenity.
Contact:

Post by Madman Lighting »

I was looking at FreeScale's MCUs, specifically the MC9S08QG8. Its a 6800 core with couple of timer/counters in an 8 pin package, I think its $0.69 in singles at Digi-key. They sell you a complete demo board, which is also a programmer, for just $50. It comes with a complete C Integrated dev environment, color syntax highlighiting, etc. Based on what I was used to ten years ago when I *first* was doing embedded work, I was floored. What they have now is almost as good as when I was building my own interface boards and programming them in C for my PC-XT.

Damn, how the world has changed in just a decade.
That Madman Who Lit Up Deep Space Nine
macfrank
Posts: 8726
Joined: Fri Oct 11, 2002 6:55 pm
Location: Los Angeles, CA
Contact:

Post by macfrank »

Madman Lighting wrote:I was looking at FreeScale's MCUs, specifically the MC9S08QG8. Its a 6800 core with couple of timer/counters in an 8 pin package, I think its $0.69 in singles at Digi-key. They sell you a complete demo board, which is also a programmer, for just $50.
I've been doing what would be called embedded work for fun and profit for close to 20 years now. One of the reasons I moved away from the low end embedded 68xx class processors is because of the very, very poor support Motorola (now Freescale) had for free or low cost development systems. It's good to see that things have changed.

Most of these small modern micros have good drive current capabilities on their port pins, so you can drive LEDs directly. I made my own AVR equivalent of a 555 + 4066 to drive the bussard dome lights in my PL TOS 1701.

Did you know that the original 6800's assembly language was loosely based on the PDP-11's? I had little difficulty in reading PDP-11 assembly language back in the day, and I used to "borrow" small algorithms and routines.

Frank
User avatar
tetsujin
Posts: 2350
Joined: Mon Feb 28, 2005 6:08 pm
Contact:

Re: Battleship processor in 8 pins!

Post by tetsujin »

Madman Lighting wrote:I'm researching what I can get for my next product and how I can do it most economically (ie: CHEAPEST) and you know what? I found a couple of 8-bit microprocessors for less than a buck each, in singles! Damn things have more ram than my buddies old TRS-80 and run faster too. What does this mean for my products?

It means its actually cheaper to put a microprocessor with 4K of Flash memory on board and program it in C than it is to use dedicated logic like a 555 or 4060. Go figure!
Pretty much. And you need fewer external components, particularly if you get a microcontroller with a built-in oscillator. (A 4MHz oscillator is plenty fast enough for what we do, and model projects aren't likely to need the precision of a crystal) I think part of this curious economy is that for something as simple as a 555 or 4060, the packaging and general manufacture has become a significant portion of the cost. Even though it's just a 4060, it still needs its own housing and pins and its very own tiny little circuit inside doing the work, it still has to be tested, etc. (I hope the commercial viability of these discrete components doesn't die out too soon because of all this. Hobbyists could get by for some time, I'm sure, by recycling old components out of old computers and such, but other than that it could really have some bad effects on the electronics hobby.)

(EDIT): You probably already know all this...
And then, of course, there's a lot the microcontroller can do that the logic circuits can't. PWM for varying the intensity of LEDs, erratic-looking or even pseudorandom flashing patterns (for "burning, damaged components" effects - which IMO look like crap when done with discrete components - far too repetitive and predictable), sequence-controlled effects (have a Trek model go into and come out of warp periodically), and so on, are very easy to achieve.

(EDIT): And this...
If you're so motivated, you could even get a microcontroller whose program code has the ability to rewrite its EEPROM or its program code - and use that feature to let people adapt the controller to their needs (probably selecting from a set of pre-defined effects that are in the chip's memory), without having to own a programmer for the chip. People sometimes keep a couple I/O lines available on microcontroller projects to do this through an RS-232 link. (Could be something as simple as opening a terminal to the chip, telling it to make it drive this line with a pulse (for a nav flasher, perhaps), with so much time on and so much time off, drive that line as a pulse with different timing (for a strobe, maybe), make a third line follow the same pattern as one of the other lines, make a fourth line be a random flashing pattern with an average "on" time of X and an average "off" time of Y for each pulse, and so on... And then invent a simple little syntax to allow people to type that data in)

Which microcontrollers are you looking at? (EDIT): (You answered that question already...) I'm basing most of my microcontroller stuff (in particular, my Enterprise nacelle flashers) these days on 16F648A's - which are more expensive than the stuff you're talking about (Around $2.00 as opposed to under $1) but they offer 14 I/O lines capable of direct-driving LEDs (15 if you count RA4, which is an open-collector output - I think you can direct-drive the LED on this line if you connect the cathode to the PIC and the anode through a resistor to voltage - to connect anode to the chip you need a pull-up resistor), a setting for internal oscillator, and the surface-mount version is nice and compact... Though I think some of the other microprocessor families out there are a little less convoluted than the 16F-series PICs.

Fun times we live in, eh? I'm better with software than I am with hardware, so I just love throwing PICs at problems that, as a kid, I might've tried to solve with discrete logic ICs.

(EDIT): macfrank: Know of any good, inexpensive programmers for the AVR controllers? My PIC programmer of choice is frikkin' tiny and cost around $30 (KitsRUs K182) - I'm interested in trying out AVR's but I don't really want to deal with the cost of an official development board.
---GEC (三面図流の初段)
There are no rats.
The skulls eat them.
Madman Lighting
Posts: 1816
Joined: Sat Mar 05, 2005 9:16 am
Location: Serenity.
Contact:

Post by Madman Lighting »

I'm more of a hardware guy. Gimmie some solder, glue, metal, etc and I'm happy. I got sucked into software cause of all the economies we just talked about although I did build and program an ultrasonic ranger on a step motor hooked to a PC for my college sr. project. (still got the code too!)

One possible outcome of this thought process is a version of my product with a socket for the MCU. Dont like the program? OK, write your own if you're so inclined. Want to pay me to do it, OK, that works too.

I just gotta be careful. Theres several companies out there with full featured products that do this kinda thing for stage lighting, home lighting, etc. Color Kinetics comes to mind. Rule #1: Dont reinvent the wheel someone else is already selling.
That Madman Who Lit Up Deep Space Nine
User avatar
tetsujin
Posts: 2350
Joined: Mon Feb 28, 2005 6:08 pm
Contact:

Post by tetsujin »

Madman Lighting wrote:One possible outcome of this thought process is a version of my product with a socket for the MCU. Dont like the program? OK, write your own if you're so inclined. Want to pay me to do it, OK, that works too.
That, or provide an in-circuit serial programming connector - that way the controller could be a surface-mount component mounted on a custom circuit board, and still be easy to reprogram. (I could probably even use such a thing - beats soldering wires onto surface-mount chips...)

'Course, my idea with the RS-232 thing was to provide a way for people to customize the program without dealing with all the intricacies of actually writing a program... Not having to deal with things like writing and calibrating the timing loop, writing PWM code for controlling the LEDs, etc. Writing code to control multiple, concurrent animations, control LED intensity with PWM, or yield a pseudo-random sequence of numbers isn't that hard, but it's also something that shouldn't have to be done twice.

Writing a serial bootloader for that job would be a bit of a chore and the serial interface would eat up a couple I/O lines - but I think there's nice potential there if people wanted to have control over the effect the module produces but not have to learn microcontroller assembly to do it.
---GEC (三面図流の初段)
There are no rats.
The skulls eat them.
macfrank
Posts: 8726
Joined: Fri Oct 11, 2002 6:55 pm
Location: Los Angeles, CA
Contact:

Re: Battleship processor in 8 pins!

Post by macfrank »

tetsujin wrote: Know of any good, inexpensive programmers for the AVR controllers? My PIC programmer of choice is frikkin' tiny and cost around $30 (KitsRUs K182) - I'm interested in trying out AVR's but I don't really want to deal with the cost of an official development board.
Most modern AVR devices can be programmed in circuit, with 3.3V or 5V. I did a Google search and found a bunch of parallel port programmers. the problem is that by the time you build a board with the all the sockets and jumper blocks for all the AVR devices you're likely to use... you're close to the price (but not functionality) of Atmel's STK 500 development board, which is only $80. I really don't like dangling stuff off of a computer's parallel port, in part because parallel ports are already obsolete, and there are no general purpose USB<->parallel port dongles.

The STK 500 communicates through a standard RS-232 serial port, so they can be used on many different platforms.

I haven't used Martin Thomas' Evertool, but I've emailed him about other projects, and he's a top notch software and hardware engineer. IHis programmer is compatible with the Atmel development system, so in turn, with the WinAVR GCC suite. If I didn't have an STK500, I'd build one of these.

Frank
macfrank
Posts: 8726
Joined: Fri Oct 11, 2002 6:55 pm
Location: Los Angeles, CA
Contact:

Post by macfrank »

tetsujin wrote: 'Course, my idea with the RS-232 thing was to provide a way for people to customize the program without dealing with all the intricacies of actually writing a program... Not having to deal with things like writing and calibrating the timing loop, writing PWM code for controlling the LEDs, etc. Writing code to control multiple, concurrent animations, control LED intensity with PWM, or yield a pseudo-random sequence of numbers isn't that hard, but it's also something that shouldn't have to be done twice.
I always leave either a serial port or a programming header somewhere. Maybe from the one project were I had to go through the program, plus into socket, find bugs, pull chip back out of socket and reprogram cycle a few too many times.

I was thinking of a "high level" language of sorts, where the user could specify what a port bit would be used for, but it either becomes very limiting quickly or very complicated.
Post Reply