Planning a DIY Data Acquisition/Engine Controller

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

Previous topic - Next topic

BruceM

#45
I haven't found a power monitoring sensor with amps, freq, and voltage all in one.  I can see the appeal of the Arduino based design for your application, and if you can get it to work reliably, you can just add another Arduino for engine control and monitoring.  

In looking at your own modified circuit diagram, I see some serious problems, and have questions.  

Your AC is 220, but I don't see a neutral identified, and instead see three hot legs.  None of which seems to be tied to any DC ground for reference. This is a guaranteed smoke maker.

If one of the legs is neutral then that can be tied to the DC ground of the iso-opamp input side as was done in the Cornell circuit. This circuit would then not really measure the 220VAC, but only one leg as shown if the DC supply is tied to the neutral. But that would then work as per the Cornell schematic, and might do the job for you.  You'd just need to double the voltage in the calculations.  This will NOT be accurate for a generator configured as 220VAC with a neutral, with unbalanced 120VAC loading.  For a 220/240VAC generator head setup as L1, L2, Neutral, you'd have to use two 120V devices.


For a genhead producing only balanced 220/240AC the DC ground could be tied to one of the hot legs, then the device would see the the full differential between both hot legs.

Either way, you can't have the measuring op amp floating relative to what's being measured.

The iso-op amp outputs also appear to be mislabeled in your drawing.  You have shown the op amp pin 6 as an output, but it is a voltage reference input. The capacitors directly attached to the output pin without a preceding resistor may be a problem, check the datasheet.  Adding capacitance directly to an op amp's output is a bad thing, and often causes instability.  If you were trying to filter the output, a 1K ohm resistor in series is needed.

As I mentioned earlier, the use of a switching DC-DC regulator as shown will destroy your accuracy.  If you look at the spec for ripple on the regulator, you'll see what I mean.  

For a dedicated voltage, current, and frequency meter, I don't like the isolated op amp design by the two Cornell students.  It's cheaper, simpler and more accurate to use an opto-isolated serial link from microprocessor to the host computer.  This solves the isolation problem and keeps the processor/analog board much simpler.  Only a single linear 5V supply would then be needed.

The jar meter which was the predecessor to the Cornell project is a better design, IMHO.  You could steal their hardware design but still use the Arduino board (though you'd have to loose the USB since you'd need opto isolated serial. 


dubbleUJay

Bruce, I labeled the AC supply legs, forgot to do that with Eagle, the component library didn't allow me to change the pin names so I had to delete them and make separate labels, sorry for the confusion. (Modified cct diagram attached at the end of post)
In ZA our Neutral and Earth is effectively connected together at the utility supply point, not that I'm reading the utility supply, but something I've got to keep in mind for the future.
I saw in the AppNotes for the 7520's that the input GND1 & VIN- are connected together, but not in the cct of Cornell ??? The same goes for the modified cct from the FEM site.
This is a bit confusing for me as I don't see how they "reference" it!
Pin6 of the IC's are Vref, again, sorry for that, Eagle didn't have a component schematic for 7520 and I chose one that I thought was the same, didn't see that pin  :-[
I should stop drawing these late at night/early morning  ;)
I see your point about the DC-DC, just shows you what experience is all about and why you are the moderator here  8)
Now my question: If I use a surface mount isolated step-down transformer (220-9) rectified and filtered, but powered from the generator head, would that be OK?
I'm worried about the voltage and frequency on start-up/shutdown not being nominal, would that matter?

Thanks Bruce,
dubbleUJay
PS- I left the DC-DC on the cct for now, will change it if you think the transformer would be OK
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

WJ, I just checked on an Avago design note for your HCPL-7520.  It shows the input side chip ground being connected to the power (neutral).  The device is not capable of floating measurement as your diagram shows now.

I did check both of the schematics- Cornell's and the other guys.  They both don't show the connection of neutral to the 5V ground.  It's just a goof on Cornell's schematic that got copied by the next guy.  This is the problem with much of the stuff on the web.  It's not your fault for copying their mistake.

Your placement of capacitors is not right, get rid of them.  You shouldn't put them on the outputs without a resistor first, and you shouldn't put capacitors directly across the inputs of the op amp.  Put a resistor between.  This is basic op amp stuff you're just forgotten.

The second 5v power could come from the Arduino board...it's very low power.






dubbleUJay

Bruce, I'm getting confused now or I'm confusing myself! (Which happens a lot lately) ;)
Attached are 2 pages from the AppNotes from Farnell for this IC.
I more or less copied the caps from that cct for protection. It did look like a non-conventional way of doing it, but who was I to point it out if Farnell had it in their notes. They have the GND1 and Vin- correctly connected BTW as you rightly pointed out.
Its been 10 years since I last put something like this together, cct's I build recently didn't need any "thinking work" as they were just duplicated from existing stuff!

2ndly, about the power, my one 5v is coming from the Arduino board, I just wanted to know if you see any problem in generating the 2nd 5v from the actual generator head with the frequency and volts increasing and decreasing on start-up and shutdown of the engine until operating speed or standstill is reached?

Hope I'm not testing your patients!
dubbleUJay
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

#49
The circuits you show are from a switching motor drive circuit, which adds some confusion.  But in both cases, you will see that the 5V ground is in fact connected to the motor drive negative.  In your circuit, the 5V ground needs to connect to neutral.

The capacitors all over the Farnell circuit are an attempt to cope with the massive noise generated by such high power switching. These types of motor drives are notoriously glitchy, generating great transients and some impressive EMI.  If we believe the published circuit, (many are incorrect) then the device is stable for such capacitance on inputs and outputs.  (I haven't studied the part in that great of a detail in the manufacturer's data.)  You're not likely to need them.



dubbleUJay

OK, thanks Bruce, from what I've gathered now, I think I can should build a prototype. I tried to order some of the IC's and I'm still waiting for the suppliers to come back to me. If I don't come right this coming week, I'll have to get them from the UK or USA.

I've managed to get an interim software solution going in the meantime.
As previously posted, I got the Inbetweno software going which just write time stamped data from the micro to a file on PC. From there I can pretty much do what I want with it.
I've been using LM35(LM34 for F) as temperature sensors, but I'm also waiting for some Dallas 1-wire temp chips which will only occupy 1 analog input and leave the rest of the pins for other things.

The KST graph program is a bit unstable on my PC, so I tried to link M$ Excel to the data logging file from a 30min run of my engine and this is what I got: (The reading does not make a lot of sense as I moved the probes around on the engine while running the test, but you get the basic idea)
On the GREEN plot one can clearly see where I changed back from WVO to Diesel as the diesel does not go through the loop around the exhaust to heat it and the temperature dropped.
I'll post some pictures on how I made the probes when I get a chance.
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

Nice temperature plots, WJ. 

WJ is using a compiler on the AVR based Arduino board, Jens, but even the Picaxe basic supports (via ow commands) one wire sensors, but I wouldn't use one wire parts as they are incredibly slow. (The parts, not the code.)  LM34/35 are what I use.

WJ,
If you need to add analog ports, there are I2C or SPI bus parts to do that directly, or you can use a cmos analog multiplexer (74HC4067) and get 16 channels on one A/D input, though that needs 4 digital outputs to address it.  An I2C 16 bit digital I/O chip like the MCP14067B might round things out to provide some extra I/O.  SPI is typically faster, but I've used and like I2C for my typically modest speed controller applications.




dubbleUJay

Jens, this is what I like about this board, most have been done: (Although with a library and digitally, not analog pin as I incorrectly stated,sorry)
http://www.milesburton.com/index.php?title=Dallas_Temperature_Control_Library
and here
http://www.phanderson.com/arduino/ds18b20_1.html

I figured that timing would be an issue, but I'm not there yet, once I put all the code together yes!
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

dubbleUJay

#53
Quote from: BruceM on November 14, 2009, 08:23:33 PM
Nice temperature plots, WJ.  
.....
WJ,
If you need to add analog ports, there are I2C or SPI bus parts to do that directly, or you can use a cmos analog multiplexer (74HC4067) and get 16 channels on one A/D input, though that needs 4 digital outputs to address it.  An I2C 16 bit digital I/O chip like the MCP14067B might round things out to provide some extra I/O.  SPI is typically faster, but I've used and like I2C for my typically modest speed controller applications.

Thanks Bruce.
I did see somewhere how to increase the analog inputs of the Arduino, maybe I should look at that, thanks.
The 34/35 are known good working sensors. The remaining Analog pin can then be used for things like oil pressure exec. in the future, as long as I then don't run out of digital pins once I start needing then for control! ???
I'll hate to get near the end of the project and than have to change everything around again! :'(

PS- and what I know about I2C at this stage is that "I to see" problems for myself in the future ;)
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

Here's some data I found for you WJ:

Table 1. DS18B20 Conversion Times and Resolution Settings
Resolution                9 bit   10 bit 11 bit 12 bit
Conversion Time (ms) 93.75 187.5  375    750
LSB (°C)                   0.5    0.25   0.125  0.0625

You can now see why I don't like the 1 wire sensors for some applications.  If the software is written cleverly, this is not as bad as it seems, but with library routines you'd best take a close look or write some test routines to see how much of the latency turns into program execution time wasted.  Note the 187 ms for 10 bit, 750ms (!) for 12 bit.  If you read 4 of these even at 10 bit resolution, that's 0.75 seconds just for the temperature reads.

The generator power output relay should not trip closed until voltage is up to snuff.  This way your equipment won't see a slowly rising AC voltage.  There are nice monitoring relays that do this, or you can make a simple one with a resistor to raise the turn on voltage of the relay a bit.

Best Wishes,
Bruce








BruceM

Thanks for the more detailed explanation on latency, Jens. I got lazy.

The trouble with dealing with the one wire latency for novice programmers is that they can't cope with the extra real time sequencing and complexity, so the slightly greater ease of wiring (cost is insignificant in a single unit) becomes the pain of software headaches.  That's not a good bargain.








dubbleUJay

Quote from: BruceM on November 14, 2009, 11:58:51 PM
Here's some data I found for you WJ:
........................

The generator power output relay should not trip closed until voltage is up to snuff...................

Bruce

Thanks Bruce, since this mornin' and your last post, I've been reading some more about the 1-w sensors and using the multiplexer you've suggested.
Jens, I can "see" what you're saying as well, almost like using the temp reading routine as a 2ndary loop somewhere, coming back to it every time.

I've more or less decided to use an extended analog input board like Bruce suggested, I looked at the 4067 (x16) and the 4051 (x8). It seems that the 4067 would be the easiest, less components and both can easily be extended for more channels.
This will mean that most of my sensors will be analog (or use DAC's), but that is what my sensors are at the moment anyway. As said previously, I hope I don't run out of Digital Outputs in the future, but there's probably a way around that as well, but the Arduino has 14 Digital I/O's, I'll use 4 for the extension board, 10 should be enough I think for control. (That's if I don't find something else that need digital BTW)
If I want to in the future, I can probably go ape with all the sensors I can connect, monitoring Wind, Solar or whatever, just depends on my sensors. If this V/A sensor works, it can be adapted to read almost anything with ease.
Your 2nd thought Bruce, I was thinking to mount the V/A sensor in my gen-head, so the supply for the 2nd 5v would be directly connected to the output, not via the load relay, but I'll be using a 5V Regulator between transformer and IC's anyway, so I don't think it would have problems.
It would have been nice though to have some sort of independent supply for it if I need it in the future again for the same type of sensor.
Some idea just struck me (Were is the light bulb smiley when you need it  ;D ) are these switch-mode AT(X) PC power supplies isolated from the mains?
Its way overkill, but can I use two of them to have 2x isolated 5Vdc rails, I've got enough of them lying around anyway and the 12V (or +12-0-12- = 24V per PSU, not using both to make 24V) can do my relay and contactor switching and probably some battery charging to a certain extend ???
I've got to put this in my pipe and smoke it for a while, but do you guys think it will work?

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

dubbleUJay

#57
Thanks Jens, I should know about the charger side!  :'(
I was thinking to justify using such PSU's for just 2x 5V rails, clearly not thinking straight!

Anyway, yes, the negative is common to all the voltages, its easy to make a mistake.
Maybe I'll just have to get a transformer with 2x separate 9or12v secondaries and built an isolated power supply.
It's just that I'll sit with the same problem in the future when I want to read a wind charger, battery bank, solar panels and/or DC alternator.
I'm planning a 24v system as my gen-head's build-in starter is 24v and gets used as a DC charger as well, so I'm going to stick to 24Vdc.

Those small DC-DC board mount converters would have been ideal if they were to work, but apparently not.  :(
Bruce, are there ANY change a 5to9Vdc inverter might work with proper filtering on the output and a 5v Regulator before going to the IC's?
I don't want to squeeze blood out of a stone, but can you see my point if they were to work? Obviously I wont use the USB to power all the external circuitry, but the ample 5v supply on a AT PSU.

Jens, do you care to give a comment on this as well maybe ???

Again guys, thanks for all the help and patients  :-[
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers

BruceM

It's a lot easier for a novice in electronics to get clean, analog accuracy using small linear supplies.  With SMPS it's much more of a project.  Tiny PCB transformers (you need very little power) are cheap, then all you need is a tiny bridge diode dip, electrolytic capacitor, 7805 and a couple 0.1 uF caps.  Why make it hard for yourself?

If your later engine monitor/control is going to be 12V battery operated, this might also affect how you do your power scheme.

If you were to draw a diagram of your system, showing what gets powered from where, including the data logging  computer, I can probably save you some trouble.  I don't think you need the isolaton amplifiers.




dubbleUJay

OK Bruce, I'll have to draw it in the morning, I'm busy falling asleep this side and it only 19h00!
And then the wife tells me it's not work sitting in front of the PC the whole day, how can I be tired! :P
Talk soon,
Wilhelm
dubbleUJay
Lister  - AK - CS6/1 - D - G1 - LR1 -
http://tinyurl.com/My-Listers