Planning a DIY Data Acquisition/Engine Controller

Started by dubbleUJay, October 21, 2009, 09:09:03 AM

Previous topic - Next topic

BruceM

#135
I've got your resistor values for the scaler, WJ.  In doing so, I found an error in my prior posted schematic, that I also have on my PCB. I goofed transfering from breadboard to schematic.  The difference amp had the + and - inputs backwards.

In addition to that, your schematic for the current amplifier needs a change.  The shunt must be in the negative power lead, not the positive.  If the load shunt is 0.01 ohm, that would be a 0.3V drop at 30 amps, too much, take a look and see if 0.002-0.005 ohm is available for you.  In your diagram  R12/R11 sets the gain, we want 30 amps to be 5V.  To calculate the voltage drop across the resistor it is just ohms law for 30amps and whatever the shunt resistance you use.

dubbleUJay

#136
Thank you very much Bruce! Now I can carry on with that 2day ;)
It makes sense about the shunt, I'm reading to "ground". I will find out if a 0.01R shunt is available, I just used the 0.005R is available from RS Online in ZA, I did use one on my schematic. Is 3W OK or should I use a 5W?
Its such a bummer that I have to work around "availability of components", it narrows my scope considerably :(
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

dubbleUJay

OK, does this cct look right to you guys?
I worked out that I need a 33 1/3 gain for the current op-amp ???
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

#138
When setting the voltage on what you show as RV1, the test point should be moved to pin one of the connected voltage follower.  You can't read a 1M ohm impedance signal directly with a VOM, and reading it after the voltage follower means any op amp offset error is eliminated.

Another issue to consider;  the current sense can be uni-or-bidirectional. In my setup, they are all uni-directional, but if you want to be able to read the sum of charge and discharge only, then bidirectional is the way to go.  That just means biasing for 2.5V reading at zero current on a 5V scale.

0.005 ohms will give you a 0.15 volt drop at 30 amps, which is 4.5 watts of heat dissipated.  A bit much, but OK if you go with say 15 watt or better shunt resistor. You want your shunt resistor to stay cool, else accuracy will suffer.

YES, you got the gain resistors right; gain for the current amp should be 33: 5v/0.15 V drop at 30 amps with 0.005 shunt resistor, less if you'd like a bit over 30 amps max.  2M/60K is 33, right on.

Makes sense to me for you to stick with the girl you brought to the dance- the AVR chips and their well supported free C compiler are highly regarded, and since you're already Arduino'd (AVR) , and will need to use some AVR C with the Arduino language anyway, you might as well stick with it.  I don't know what hardware you need to program the AVR chips, but I'll bet it's not much $.






dubbleUJay

#139
Quote from: BruceM on December 04, 2009, 07:16:07 AM
When setting the voltage on what you show as RV1, the test point should be moved to pin one of the connected voltage follower.  You can't read a 1M ohm impedance signal directly with a VOM, and reading it after the voltage follower means any op amp offset error is eliminated.

I thought there was a mistake on my cct Bruce, thanks.
What confused me was that your original Batt Scaler cct said:
"Set R3 for 3.43V at Ux pin7" Your trimpot is R22 & pin7 is on the spare opamp ???

Quote
Another issue to consider;  the current sense can be uni-or-bidirectional. In my setup, they are all uni-directional, but if you want to be able to read the sum of charge and discharge only, then bidirectional is the way to go.  That just means biasing for 2.5V reading at zero current on a 5V scale.

0.005 ohms will give you a 0.15 volt drop, which at 30 amps is 4.5 watts of heat dissipated.  A bit much, but OK if you go with say 15 watt or better shunt resistor.

For my 1st sensor I'm going to read my 24Vdc 5A Control Battery Charger from my Gen-head. I'll scale it to say 10A and would only need to dissipate 1W5 so my 3W resistor should do. I can see myself battling to find a 15W though!

Quote
Makes sense to me for you to stick with the girl you brought- the AVR chips and their well supported free C compiler are highly regarded, and since you're already Arduino'd (AVR) , and will need to use some AVR C with the Arduino language anyway, you might as well stick with it.  I don't know what hardware you need to program the AVR chips, but I'll bet it's not much $.  

That's what I thought, I just hope that I can convince Daryl to this idea ;) If I use the AVR nodes with on-board I/O's in the future, I'll be familiar with the language.
The Arduino AVR comes pre-programmed with a boot loader and you can get the chips by themselves with boot-loader installed, from some suppliers.
The board has ISP header on it, but it gets programmed directly with the USB cable at the moment.
I've got the AVR Compiler somewhere, but I never actually used it, the header programmer costs a few $ IIRC.
OK, I'll get the parts for the DC Sensor soon and built it.

O-yes Bruce, one thing, can I put 5V1 zener protection on the output to the Arduino? I'm worried about a spike if someone short the battery leads for a split second and it draws a huge current that gets transferred to the output ???
Or am I talking rubbish?
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

#140
WJ-  Sorry, I noticed that as usual, my schematic was pretty bad.  I don't assign part numbers until I do the PCB layout, and then sometimes I just don't, or get them wrong.  I sort it out when building the prototype.  

On my voltage scaler, my utterly frustrating memory problems sure showed-  I HAD fixed the problem of the +,- input reversal when I did the PCB layout, BUT THEN FORGOT to change the schematic.  5 days later, when double checking the finshed circuit board after receiving it, I newly FOUND THE "error" in the board compared to the not corected schematic, had no recollection of the PCB fix, - and modified it back to WRONG!  Now I have to undo the two cuts and jumps.

If you do the voltage/current circuit on regulated 5V, the output CAN'T be over 5V, so there is no spike issue.  If it was running on say 12V battery, then you'd use  a zener to limit the output from a spike, after the 2K ohm resistor and the reference voltage for the difference amp (subtraction) you'd generate via a micropower adjustable reference.

As for architecture and processor choices, there are plenty of good ways, and I'll encourage anything that can reasonably be expected to succeed.

For my own system, low power was a big priority.  I don't always run the generator head but more often the air compressor.  So the controller is running off of an old 12V AGM battery (still plenty of capacity for this use, not for it's original) with a 40watt PV panel.  I have more experience and didn't have any need to add more processing power. Having designed and built many real time multiprocessing systems, I had no lust for more than the simplest controller that could do the job, and a single 40X1 did it all with no expansion required.

A poky one second frame rate, for example, I thought was totally adequate, and allowed me to use the cpu time chewing count command for rpm sensing, instead of adding a frequency to voltage chip, and reading RPM as an analog value.  If I needed more processing power, that's the first thing I'd do.  The next would be to use the Boost Basic compiler, which would give me about 10x more speed (which I don't need). And then I can quadruple my speed again by using a 16Mhz resonator instead of the built in 4Mhz.  

I don't see anything in your plan so far that I couldn't do with a single 40x2, probably with no expansion.  Or a single AVR chip with some expansion, or a few of each, just for fun.  And I like the Ar-ar-arduino (multi arduino) too.  :)  If you have the power budget; "got a task, get another processor"  is an approach which can help break things down into more manageable pieces, and as Daryl says, it IS how most big projects that came out on time got done. It allows big teams to separately and independently work on different parts, with well defined  interfaces between them.




BruceM

#141
For anyone who might be interested.  My favorite opto-mos part for switching 150ma of up to 240VAC to control an AC relay:  AQY214EH.  It's a 4 pin dip. $2.11/1 at Digikey.


Crumpite

Quote from: BruceM on December 04, 2009, 02:27:33 PM
For anyone who might be interested.  My favorite opto-mos part for switching 150ma of up to 240VAC to control an AC relay:  AQY214EH.  It's a 4 pin dip. $2.11/1 at Digikey.

I'm taking careful notes of all of these great hardware recommendations !

I've decided to bite the bullet and am in the process of learning the Arduino's version of C.
It takes a lot these days to make me learn a new language, but this forum has lit my fire I guess.  :)

I'm *still* trying to get up to speed on all of the topics in this mail list, but I'm making progress.

DubbleUJay - on my previous posts I didn't mean to imply that we needed a mix of Arduino and Picaxe for this application, just that if we set this up correctly, any flavor of micro can be interfaced.
Do you have any plans to do engine control too ? I'm just curious (I'm half cat I think sometimes) as to your further plans.

It might be an idea to come up with a little tiny board that can handle all of the current loop communications.
Something that you could hook up to any random voltage for the powersupply and has an input and output connection to the micro of choice and a current loop out.
It would give a common interface that would be garinteeded to work. If any problems came up you could be sure that it was in your programming, not the hardware.

I like the Jeelabs stuff, but wireless is untrustworthy, IMHO, and would be a lot more expensive than an optoisolator and transistor/fet on a board...

Comments ?
(time to get an Arduino on order too)
Daryl



BruceM

#143
Glad you found the opto-mos helpful Daryl. I was a happy camper when I found those, originally I could find only 120VAC capable ones by Claire, and my primary AC is all 240. I use one at the end of a few hundred feet of twisted pair form my remote well pump control.  They can also be used for DC, some units up to 300 ma load or better, high voltage.

I'd just integrate the opto isolator on the board with whatever other extras and interface are needed for a "slave" processor. The driver might be direct from the processor, or a transistor buffer, or 74HCTmos which can drive 25ma, along with some other buffered outputs. In many cases, you may have a gate or something left over that you can use for the output driver.  I suggest avoiding unnecessary segregation- it just adds more wiring, power and hookup, and more points of mechanical failure.

But it does mean planning instead of just building the pieces and cobbling, and for prototyping, I'm for whatever works for you to get the job done at your own pace and style.


dubbleUJay

#144
Quote from: BruceM on December 04, 2009, 01:09:41 PM

....my utterly frustrating memory problems .....

.....And I like the Ar-ar-arduino (multi arduino) too.  :)  ...........


Bruce, I cant begin to imagine how frustrating that must be!  :'(

The other point: We'll see what Daryl thinks of the idea of using AVR throughout, I'll certainly will go for it obviously ;) I rather like the bare-bone "Arduino" node with I/O's, coupled with your Opto'ed RS232, can't get much simpler than that I think!

;) You still out there Daryl?  ;)

Modified: Sorry guys, I posted this and when I hit enter, all of a sudden there was a few posts I didnt see ??? Now to read them! I'll be back ;)
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

dubbleUJay

Quote from: Crumpite on December 04, 2009, 04:15:38 PM

I've decided to bite the bullet and am in the process of learning the Arduino's version of C.
It takes a lot these days to make me learn a new language, but this forum has lit my fire I guess.  :)

No that's good news Daryl, I was beginning to think I'm the only one that thought this is the way to go.
If you don't already have it, get the "ARDUINO NOTEBOOK" for reference, it has a few basic I/O cct explanations at the end.
http://www.arduino.cc/playground/uploads/Main/arduino_notebook_v1-1.pdf

FYI, I've got the Arduino Duemilanove board, but any should work:
http://arduino.cc/en/Main/ArduinoBoardDuemilanove

Quote
Do you have any plans to do engine control too ? I'm just curious (I'm half cat I think sometimes) as to your further plans.

Yes, but I thought it best to do the Data Logger 1st as a lot of the controllers inputs or variables would be coming from it like over temp, oil pressure, speed exec. The plan for now is to use 1 Arduino to do both if possible, but it can be split in 2.
In the future I have:
Small irrigation system to control
Commercial borehole pump controller with I/O to interface and monitor & control
a "Temporary shelved" wind turbine to monitor
and a few other odds and ends.

So you can see there's a lot of future plans ;)

Quote
It might be an idea to come up with a little tiny board that can handle all of the current loop communications.

That would be great, but we need to also decide if we're going to use "series or parallel" topology? I think just T-ing off from one board to the next would save a lot of wiring, but I don't know what the hardware/software consequences would be?

Quote
I like the Jeelabs stuff, but wireless is untrustworthy, IMHO, and would be a lot more expensive than an optoisolator and transistor/fet on a board...

I also think that wireless should only be used were one really need it. I have one application for it, so I would like that as an option. I was thinking of using the JeeLabs idea with our own comm's on the board.


A few thought on the comm's:
Personalty I would build my own AVR "nodes", but say someone wanted to buy a few off the shelf Arduino's and do this project? He would need an USB/RS232 interface between that and whatever we use.
If we can come up with something that would directly interface with Arduino, it would be nice.
On the other hand, he'll have to build the "network board" anyway ???

Something else as well:
For the analog expansion ports, Seeed Studio does sell a few flavors, but although the code would basically work the same, I don't know what I/O pins they're using, if I knew, I could make mine the same and theirs would be compatible to this project as well?

Soooo many questions!!! We'll get there in the end though ;)

NOW, back at you, any comments? ;)
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

dubbleUJay

Bruce, on my DC Voltage probe were you worked out the values of the resistors for the voltage reading.
How critical is the resistor values ie the 327k & 178k? I can make up the one(178k) with 2x resistors, but the other one(327k) will have to use 3x resistors to get the precise value!

Thanks in advance,
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

#147
With fixed resistors if you lower the gain slightly, you won't "lose" high  voltages by having them go to the 5V rail, then you can just measure what you have (ohm meter), and change the software calculation to match those units.  

Does the Arduino language and your board support I2C?  If so, if needed, a second board could be an I2C slave.  That would be a big improvement over asynchronous serial data transfer.   I2C is a 400KHz two wire bus that must be short, the second processor would need to be co-located with the first.  And of course then either processor could still have an asynchronous serial link to a remote processor.





dubbleUJay

Thanks Bruce and yes, it does support I2C, although by using a library called wire.h
http://www.neufeld.newton.ks.us/electronics/?p=241
I could have used it for my 16ch expander as well I suppose if you look at the link. I see it can support up to 127 devices!
So this will work for co-processing at the same location. (Short distance)

Do you have any suggestions on using comms over longer distances, but that can be daisy-chained?
Obviously keeping the hardware as simple as possible.
As usual, my networking knowledge is limited, but I should pick it up quickly I hope!  :'(
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

dubbleUJay

AND, a final question for tonight: ;) (Maybe I'll check-in later if there's sh!t on TV though!)

What programming platform would be popular to write a UI with?

I'm leaning towards Java as I see it getting used all over for Arduino projects, but I dono notin' about programming applications and would like to read up a bit so I don't come forward as a complete idiot once we get to that stage! ;D
If Java is the "thing" anyone know of a free Java System Development Kit for it? I think that's what its called ??? Most seems "website" orientated.
WYSWYG would be nice for a beginner or am I dreamin'?
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers