Shop OBEX P1 Docs P2 Docs Learn Events
Which microcontroller to use for this? — Parallax Forums

Which microcontroller to use for this?

Pier39 LabsPier39 Labs Posts: 4
edited 2007-12-04 19:08 in General Discussion
Hi all,

I am trying to design a circuit that will do the following

1) Take 0-5V analog input from a temperature sensor, an airflow or pressure sensor, & a VR or hall effect sensor. Also from a position sensor & lambda (O2) sensor.

2) Scale that voltage for the temp sensor, pressure sensor & VR sensor based on a pre-loaded table of RPM vs signal.

3) Output the scaled voltage in 0-5v analog form.

4) Typical sensor response time to transient input is 1 ms. So the circuit should be able to generate output as fast.

This is basically for building a unit which tricks a standard automotive EMS (engine management system), effectively changing the ignition & fuel injection parameters. I came across a circuit which does the exact same thing using BASIC stamp 2, however it used only two inputs & controlled a digital pot. I'd prefer to use something that can be programmed with C.

Can you guys suggest me a suitable means of doing the above? Any help will be greatly appreciated.

Sorry if I am sounding very elementary, I am a mechanical engineer, I know very little electronics other than basics.

Post Edited (Pier39 Labs) : 12/3/2007 1:16:35 AM GMT

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-12-03 01:45
    There·are·two C compilers for Parallax's SX microcontrollers, one is called SXC.·

    http://forums.parallax.com/showthread.php?p=682422

    Using http://search.parallax.com type in "SXC" and take it from there.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-03 01:53
    You will need an Analog to Digital Converter, probably one with 8 channels. From Parallax, the SX and Propeller processors are the only ones that can handle the minimum response time of 1ms.

    The SX can be programmed in its assembly language or in a version of Basic (SX/B). There are one or two C compilers for the SX, but none of them are currently supported by Parallax. I can't vouch for their quality. I'm sure others have experience with them.

    The Propeller can be programmed in a mixture of Spin (a language with some features of C, Pascal, and Python) and assembly language. There's a 3rd party C compiler that is expected to be available in a month or two (from ImageCraft). The Propeller is a 3.3V processor, but can interface to a 5V ADC and can do its own digital to analog conversion, but only to about 3V. You'll need a buffer to get that up to 5V full range.
  • Pier39 LabsPier39 Labs Posts: 4
    edited 2007-12-03 02:23
    How do I convert my requirements to match the microcontroller specification?

    The way I see it, if each sensor sends a signal every 1 ms, then there are 5 sensors, so that makes it 5 instructions / ms, and multiply that by 2 for the output. Meaning I need a controller capable of handling atleast 10000 instructions/second. . Is this correct?

    One other requirement is that it should take power from a DC 12v input source (can go up to 15v sometimes).

    I looked at the SX, but it seems to be too expensive & over-powered (atleast at first glance) for my needs. For that money I can get a standalone EMS which will replace my existing one. I am looking for an inexpensive option to that.

    Mike as you said it needs a ADC, 8 channel means that it can handle 8 inputs? And I presume I would also be needing a DAC for converting the signal back.

    Sorry I am asking so many questions all at once.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-12-03 02:41
    OK

    What does a "standalone EMS" cost then?
  • Pier39 LabsPier39 Labs Posts: 4
    edited 2007-12-03 02:57
    DIY versions cost less than $200 to build.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-12-03 03:13
    An SX-Key (the programming tool) is $40 or something and an SX is less than $3, but then all of the ADCs, sensors, support circuitry, and assorted etc. will be·more than that, plus your time, too.· The choice seems clear on that basis.
  • Pier39 LabsPier39 Labs Posts: 4
    edited 2007-12-03 03:32
    Ok. That seems reasonable because the sensors etc. are already there on the engine.

    Essentially this is what I'm trying to do:

    http://www.umaine.edu/MechEng/Peterson/Classes/Design/2005_6/Projects/ECU/Piggyback Design.html

    But, like I said before, it will have more than one potentiometer to control multiple outputs, and also some way to govern the VR sensor's output.

    Let me rephrase my question: What is the best & most economical way to achieve this functionality?

    Post Edited (Pier39 Labs) : 12/3/2007 3:44:40 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-12-03 06:03
    1) "... best & most economical way ... ?" is not a useful question without providing much more information on your criteria. Costs may depend on your volume, development environment, experience, etc.

    2) Both the SX and the Propeller can do the digital to analog conversion with only an external resistor and capacitor although usually you'll need a buffer which could be an op amp or a transistor and a couple of resistors. The Propeller can also do the analog to digital conversion with only two resistors and two capacitors, but you'll need a voltage divider to reduce the input range from 0-5V to 0-3.3V. I think the SX can do one or two channels of ADC, but the Propeller can do two per cog (processor) and there are 8 processors. One processor can do the DAC and all the computations involved.

    3) Even though it seems like overkill, the Propeller would simplify the development work assuming that you're only making one. You could use one cog to feed a VGA monitor to provide real-time monitoring of the sensor data. $20 would get you a Propeller Protoboard and you'd need a PropPlug USB to serial adapter for $30 that you could use for other things. $15 would get you the VGA adapter if you want to use it and that gets you a PS/2 keyboard and mouse connector. The Protoboard would run off 12-14V if you don't draw too much current (the regulator is designed for 6-9V input and will overheat at 12-14V if you try to draw anywhere near its 1.5A rating). A Propeller by itself would draw under 100mA.

    4) If cost is the major consideration, one of the PICs with multiple ADCs would probably work, but you'd have to look for help elsewhere.

    Post Edited (Mike Green) : 12/3/2007 6:33:02 AM GMT
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2007-12-04 19:08
    I would recommend the propeller.· If you can program the bs2 I think you can make the jump to the prop fairly easily.· I would use the propeller with a mcp3208.(remember to power the 3208 with a voltage at least as high as the highest adc current or it will do funny things).· Microchip also has a number of dac converters.· There is a driver for the 3208 and I think you can find or modify an spi driver to work with the dac.· If you are looking to do it cheap you can make your own propeller programmer for a few bucks or build it into your board.· It is downloadable from parallax.· It consist of a few npn and pnp transistors and some resistors.· I have built it and I know it works.· However the usb option works well also.· Like mike says you can do your debugging on a vga monitor.· It is a good idea to protect the adc inputs with a resistor and possibly even a zener diode even though the 3208 has clamping diodes.
Sign In or Register to comment.