Main Site Documentation

Multiple Analog Output Project


I have a project that requires the following IO. I have two FEZ Cobras and one FEZ Mini. Is it possible to do this or do I need to pick up some additional hardware?

First Board
(1) CAN
(6) Digital Inputs
(8) Digital Outputs
(6) Analog Inputs
(4) Analog Outputs

Second Board
(1) CAN
(3) Digital Inputs
(1) Digital Output
(1) Analog Output
(1) Analog PWM Output

If I need more hardware could you recommend a configuration?




You will need to add an analog out chip over SPI


Being more of a programmer than an electrical engineer, are you referring to a DAC module like the MCP4921? Does GHI sell any modules that would give me multiple analog outputs or do I need to build my own? Would the GHI IO60P16 Module work? I appreciate any advice. Thanks.


So how many DAC outputs do you need? What are they connected to (ie can you “fake” analog with PWM?)


The first board is connected to an automobile HVAC control panel. The 4 analog outputs control the actuators that open and close for defrost, panel, floor, and re-circ settings.

The second board is connected to the HVAC compressor and fan. The two analog outputs control the fan speed and the hot/cold air blender.


This project is heating up and I’m desperately in need of a multiple (4+) analog output module that can communicate to a COBRA or COBRA II board. Any suggestions would be greatly appreciated.


So have you tried the PWM method of faking an analog signal?

How does an analog signal control the actuators - I would have thought they’d be open/close type actions? Have you checked what voltage signals your current device/s output to control them? Any references?


Brett, I think PWM might work, thanks. I’m going to try this method. What do you think?

I have another project where I’m simulating switches on a dash to a controller. They all use 12v DC, some hot and some ground.

As far as the actuators go, I’m just the programmer. I’ll have to talk to the HVAC engineer about how it all works.


@ SkierHiker -

You could use the MCP4822 that is 2 channel, more easier than MCP4821 as SPI need a CS per chip.

12bits resolution is sufficient in your case (car heating). After what, talking with the heat team is a good thing to check for voltage and operating current they need !


@ LouisCpro -

This is going to show how much of a non-electrical engineer I am but does the MCP4822 then allow me to output 5V to activate a 12V DC relay?

@ Brett -

The PWM arduino example uses a RFP30N06LE MOSFET to control a high voltage circuit. But it looks like the Arduino outputs 5V on it’s PWM instead of 3.3V for the Cobra and the MOSFET says it wants 5V. Do you think the Cobra PWM will work with the MOSFET?


If you need to activate a 12VDC Relay, you does not need any analog output, just a simple digital outputport…If you want to avoid electronic first, I suggest to have a look ont the several modules provided by GHI, in particular : => This one will drive one of your several motors (Up to 40V and 3A to check with your team) => This one to command the relays.

Then, when you will have validate thoses modules, all the schematic are open source so that you’ll probably fin an independant electronic guy to build a board for you without spending to much money !

To answer your question, it’s often convinient to use at least a protection circuit between the PIN OUT and the relay, that also enable to put the right voltage in the relay without impacting the output (optocoupler, transistor and so on…). But really, I engage you in buying a gadgeteer board and some module to have test !

When can help you choosing the right one !


Mark, I don’t think you have specified your analog output requirements (voltage range, resolution, output drive, etc) but you can add a simple RC filter to a PWM to change it to an analog output, as shown here:
If you want to control to an accurate voltage, feed the resulting analog out back into one of the device’s analog inputs, and put a control loop around it. (This is software, so you should be back on home-turf with it!)
Normally you would use a PID loop, but it depends on you application. With a slow moving analog signal you often only need to implement the I (Integral) component, with low (sluggish) values to avoid hunting.
If you need a greater output range than the 3.3V output allows, you can drive a FET with the PWM, and have it sourced from the load or other higher supply. In this case you will need to bring your analog input back through a voltage divider (two resistors) to keep within the device limits and range (0-3.3V).

We do something similar with our industrial calibration equipment. The analog output is only 8-bit while the input is 18-bit, but because or feedback tells us exactly what the out put is (rather than the open-loop 8-bits) we can automatically calibrate the device under test to that value.


You could use a darlington or optoisolators to drive a relay which would drive your actuators. The board would just be switching the little switch that turns the big switch on and off. Any analog pin on any board can do that.

Are you wishing to also sample the pressure cutoffs and modify the actuators accordingly?