Newbie help needed

Hi all,

I hope this is the appropriate group for my query. Quite a few seem like they might fit: automation, robotics, &c. but I choose you guys, because you're popular... (like high school all over...)

For my winter fun project I was thinking about attaching some "real world" true analog gauges to my PC. On the PC side I will do some scripting to scrape some HTML and determine how busy certain websites are, and then adjust the needle on the gauge to match. so:

Requirements: USB interface to PC, Ability to control via script, possibly via compiled executables on the PC. Analog outputs, a gauge or three (digi-key must have some, right? Grainger, I suppose if not.) Total cost < $100 (?)

I've got some (rusty) electronics background, and am comfortable with a soldering iron.

My questions are mostly around the big issues: What's the best architecture for this? PC -> Microcontroller -> output ? or is there some way I can skip the microcontroller?

How do I begin to decide what Microcontroller and dev environment to use? Seems like there are plenty of options. I don't have a clue on what I care about or what I don't. Recently I've been doing some high-level language stuff in Visual Studio, but I know that's over kill for the code for this project. For me, the fun of this project is really going to be on the PC side, in the code to aggregate Web info and decide what analog values to give that, so I'm trying to keep the PC to the display part of this as simple as possible.

And down to the details: I'd really like this to be controllable via USB. Is that adding too much complication?

Any help or pointers to blogs/articles/anything greatly appreciated. searches on PC USB and Gauge didn't really turn much up.

James Fraser

Reply to
James Fraser
Loading thread data ...

Find a microprocessor that has a USB interface and a PWM. Then make sure that there's lots of demo code for the USB -- I'd make it look like a serial port if I could, and send it text for the gauge.

Then use the PWM as a cheezy DAC to drive the gauge -- with the right gauge you'll be able to do this from an RC filter from the micro.

Analog gauges cost money -- check out the surplus houses like All Electronics, MPJA Associates, Herbach & Rademan, etc., for cheaper alternatives than new, name-brand analog meters.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

Thanks for the advice and the warning. It seems like there are a lot of options for microprocessors/controllers, even when I filter for USB and PWM. Is there any place to get reviews or comparisons of these? I know that a lot of it will be personal preference, but right now, I don't think I have any. Is there a particularly popular architecture or dev environment that might be a safe bet to get me started?

Maybe I should start with a book or some website reading?

Feeling lost in the number of options... James Fraser

Reply to
James Fraser

It's hard to go wrong with Microchip, if you don't mind assembly language programming. Those 35 easy-to-remember instructions can make your code rather bizarre at times, but you can get the job done.

If you are more comfortable in C it's easier to get a free compiler for an AVR, and _much_ easier to get a compiler that's fairly ANSI compliant. However, I don't know how the AVR is for the USB thing.

--
Tim Wescott
Wescott Design Services
 Click to see the full signature
Reply to
Tim Wescott

Are you really sure you want USB? Serial would be far easier to implement and significantly widens the choice of microcontrollers available. You're not going to need to shift data to the gauge controller at very high speeds.

That's good advice but, as I said before, if you use serial then the port will already look like a serial port. Plus you could pick a micro that has a built in DAC to avoid the PWM aspect but it won't be as much fun or as educational. Of course, a USB solution provides power as well.

They needn't cost much. An el cheapo analog multimeter could be canibalised or there will be many suitable gauges in a car junkyard. Although in retrospect there may be an issue in finding 12V. A temperature gauge gives you reds and greens which would translate nicely enough to web activity.

Reply to
Tom Lucas

If you go with an ARM, you have the advantage that the demo compilers (IAR etc.) are for free, up to 32 kB of code, which looks more than sufficient for your needs. If you go with an 8 bit chip, then your free choices are normally limited to about 2-4 kB which is probably not sufficient. Atmels AT91SAM7S321 has an ARM7TDMI core USB and there is an USB CDC (Communication Device Class) driver for it free of charge. You can program the device using a serial port or USB.

--
Best Regards,
Ulf Samuelsson
 Click to see the full signature
Reply to
Ulf Samuelsson

Not Quite Microchip's PIC18 USB chips use a C language library. The old PIC16C745 is OTP, but was done in ASM.

Reply to
Neil

Thank you all for the input, it's been very helpful: In doing a moderate amount of reading and research yesterday, I changed direction a little bit:

-It looks like USB interfaces aren't as straightforward as I would have hoped. Drivers for the Host PC, and lots of room for problems.

-Ethernet and IP for microcontrollers seems a lot more mature than I expected. Right now I'm leaning towards this for the interface to the PC.

Script on PC sends command (via IP/http or UDP maybe.) microcontroller gets command and uses i2c serial bus to a DAC to set voltage out. This seems to give an easier, more general (less configuration) interface to the PC. and if I read things right, I think I could put in multiple i2c DAC's for separate gauges.

I would like to keep circuit dev time to a minimum. For me, the big fun will be in deciding which and how much information to aggregate to the gauges. (i.e. how could server health be summarized with a single number? It's not an average, because when disk used goes from 90% to

100%, the server health needs to go from medium to terrible.)

So now I'm looking at netburner or microchip ethernet development boards. They are above my original budget, but look like they should get me up and going quickly.

Thanks again all for the help. James Fraser

Reply to
James Fraser

Ethernet has a much longer 'reach' - USB only handles short desktop cables.

Or this from SiLabs ?

formatting link

-jg

Reply to
Jim Granville

Ethernet isn't much less complicated than USB, although if you pick your device carefully there may well be some open source software already written. Check out the sort of things supported by FreeRTOS.

However, I would still maintain that simple serial is going to present with the shortest development time and there is code galore all over the internet to get you up and running.

I2C only needs the one bus if you are careful with your addressing so you'll save effort on PCB layout and part count.

Perhaps ping someone from time to time and gauge how long the response takes? Might give a jumpy gauge though.

Reply to
Tom Lucas

or this, I suppose:

formatting link

It looks like I need the $120 answer to develop what I want. The $30 answer you linked to wouldn't allow new code needed to hook up a DAC, I think. Correct me if I'm wrong.

James Fraser

Reply to
James Fraser

I'm sure that serial would be easiest to implement on the microcontroller side. I just don't want the limitations that places on the PC side. I see four laptops in the office I'm in. One has built in serial. two have parallel, all have built in ethernet and USB. Yes, I know, I could get PCCards or USBserial converters, but that's a headache. I really don't want my choice here to limit my computer options in the future. This isn't getting built and permanently attached to a legacy PC. I hope to be able to put this on my desk with what ever PC is there for the next 10 years or more.

I'm very interested in this, and I will be doing some research on the local bus / interface options. I read a little bit about I2C versus spi. I would really like the ability to attach multiple DACs.

Thanks again... James Fraser

Reply to
James Fraser

For ethernet, unless you are building the box as a gateway (always be there), you have to deal with IPs, routing and configurations. USB is probably a better choice. I assume these laptops are Windozs, so you will have fun with USB drivers anyway.

Reply to
linnix

Good points on etherrnet. It looks like the netburner solution and others have decent IP stacks that take care of the level 3 and lower stuff.

I don't know what you mean that I have to deal with USB drivers anyway? Why would I need to do anything with USB if I'm contacting the microcontroller via IP?

Jamie

Reply to
James Fraser

formatting link

My understanding on these, is yes, you need $120 for the first one, to get nice debug access, but that the $30 one will allow code-changes (they give 3 different demos?), but not debug-access to the break point/watch level.

-jg

Reply to
Jim Granville

It may not be the headache you expect. SiLabs have USB-UART soltuions, but probably the leader here is FTDI, so I'd suggest you grab a FTDI eval, and pop drivers into all the PC's you can find, and see how it runs.

Their US232R-100 looks pretty simple and painless. All packaged, and low cost.

-jg

Reply to
Jim Granville

So use serial on the microcontroller side along with something like an FTDI serial/usb chip. You get the ease of serial port dev without needing to develop USB drivers on the PC side.

Robert

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
Robert Adsett

I looked into this a bit further. Both Microchip and Silicon Labs would require that I buy the full version of the development environment for $495. (Microchip requires the full version for support for some of the chips with ethernet, and Silicon Labs requires the full version of the Kiel tools to have more than 4 KB code. Even their example web app requires more than 4 KB and can't be compiled with the limited version.)

So right now I'm considering Netburner or a simpler serial option using a USBSerial bridge, as mentioned earlier in a different branch of this thread. I'm leaning towards netburner, mostly for the feature of http control of the device. Still a bit more research to do first.

James Fraser

Reply to
James Fraser

FTDI have some nicely packaged USB-DB9 moulded RS232 links.

To avoid the tool-jump effect you mention above, you could also look at Zilog - their eZ80Acclaim is recently revised to PluseZ80AcclaimPlus, and they have good free tools, and the Ethernet modules start at $46.67 & $75

-jg

Reply to
Jim Granville

If you don't want to pay for development tools, I would push you back into AVR. AvrStudio/win-avr/gcc-avr are free. ISP downloader/USB bootloader are possible. AT90USB82/162 (8K/16K usb device) are more than enough for a guage. There is also AT90USB1286 (128K) if needed.

Reply to
linnix

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.