Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:47 04 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : modular power logger

     Page 1 of 2    
Author Message
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 06:09pm 15 Dec 2012
Copy link to clipboard 
Print this post

Just contemplating a concept for a flexible data logger system.

My primary target is the 12V vehicle/solar/fridge setup I use for camping.

There are lots of solutions around however I considering the following setup for a flexible system.
I use 50A Anderson connectors for major connectivity and the Anderson powerpole connectors for smaller ( lower current ) connections.
I'd like to measure the current and voltage at differing nodes throughput my setup.
The current is pretty straight forward using the Allegro current sensors and a voltage divider for the voltage. The problem comes up with potential earth voltage differences around the system and the potential to end up with unwanted earth paths through the sensing/measuring system.
So the concept is to use the allegro current sensor ( pick type depending upon range required ) in the negative cct, a simple resistive divider for voltage, a 5V regulator a 8M series picaxe to do the a/d and provide a serial o/p and an opto to isolate the serial o/p.
The picaxe could be calibrated individually in s/w to compensate for tolerances.

This way various 'isolated sensor' boxes could be plugged in as required around the system and a central logger could collate and record the data ( ie a maximite ).

With the maximite only having two serial ports which would limit the system to having only two attached sensors. I'm thinking of using the open collector o/p from the opto as a pseudo party line connection for the tx data from the sensors and just commoning up the sensor rx lines so they can be polled individually. The sensors would need some sort of id code to prevent them responding simultaneously but this just requires a simple coms protocol and configuring an ID into each sensor picaxe.

Has any seen anything else like this around? Or any thoughts on the concept.Edited by greybeard 2012-12-17
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 07:38pm 15 Dec 2012
Copy link to clipboard 
Print this post

[quote=greybeard]Just contemplating a concept for a flexible data logger system.

My primary target is the 12V vehicle/solar/fridge setup I use for camping. [/quote]

This sounds like a perfect application for my i2c modules e.g 7 channel 10 bit adc,4x7seg led or 2 line x 16 lcd, 12 key keypad, plus a i2c eeprom for logging. You would need at least an 18x picaxe for the i2c functions.

I have put together many such combinations in the past. It is easy mix and match modules to suit requirements and do the programming and number crunching in the 18x basic.

If you like, you can even do your own pic i2c master for serious number crunching. If you can't do pic assembly language, I and I'm sure others on the forum could help out.

I have a particular interest as I too have a traytop slideon camper with similar arrangements and am looking for the elusive round tuit.

david m
David M.
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 08:44pm 15 Dec 2012
Copy link to clipboard 
Print this post

Hi David.
I did consider i2c but it doesn't give me electrical isolation between sensors. With the variety of vehicle setups, wiring, earthing, +ve and -ve current sensing setups I feel it must be electrically isolated. This way I can measure MPPT operation ( -ve switching regulator ), fridge current draw etc and not have any concerns with feeding high currents through introduced earth paths. Motor vehicles are a pretty hostile electrical environment for low level signals.
With what I'm considering 2 a/d inputs are all that are needed at each node.
So the choice as I see it is to either isolate the a/d inputs or make them self contained and isolate the serial interconnect.
I'm also looking at more of a data logger application rather than trying to do any significant processing in the sensor/logger devices.
As far as programming goes I'm probably going to be ok for that as I've been coding embedded systems since the late '70s

I coudl see a possible use for i2c lcd and keyboard. Another alternative for the colour maximite would be to plug in a arduino lcd & keypad directly onto it and then it would just need to be mounted as a complete unit.

All good feedback though.
GB
 
MOBI
Guru

Joined: 02/12/2012
Location: Australia
Posts: 819
Posted: 09:47pm 15 Dec 2012
Copy link to clipboard 
Print this post

[quote=greybeard]I've been coding embedded systems since the late '70s [/quote]

Sounds like a familiar vintage.

I think you want a far more eleborate system than I do. All I really want to know is battery state of charge/voltage. The only reason I suggested 7 channel 10bit adc is because I have one but of course, don't need to use all adc inputs.

Also, I don't need logging, just current state of affairs plus display. The i2c keypad makes selecting functions or setting rtc etc dead easy.

Adding a data expander would allow a stack of digital io for devices like ir remotes for switching lights etc. Just throwing in ideas. I have an IR to I2C reader (it is a function of my ps2 keyboard to I2C module.

david m


David M.
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 09:48pm 15 Dec 2012
Copy link to clipboard 
Print this post

Maybe this can be used to isolate them:
http://www.ixysic.com/Products/OptBusRepBiDi.htm

and an article:
http://www.edn.com/design/analog/4370410/Optically-isolating -an-I2C-interface-Beware-of-nonlinear-propagation-delays

But to be honest it seems to be a complicated way to get it done.

Maybe use rf?
Each node can send/receive.
You just use one serial port on the maximite for the rf node that is the 'reader'.
Each voltage/amps meter device can can send their values on intervals.
No need to write a protocol to prevent/detect collision as it is a built in function of the rf chips.
Edited by TZAdvantage 2012-12-17
Microblocks. Build with logic.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5912
Posted: 09:58pm 15 Dec 2012
Copy link to clipboard 
Print this post

I am slowly gathering the parts for my van monitoring system.

The Allegro current sensors are my choice.
For protection on the other inputs I will use LM324's which are cheap and have reasonable input protection. They can also do a bit of filtering.

The Maximite will have a 7 inch LCD with touch screen to save the need for a keyboard.
I an using LM335's for temperature sensors in the fridge and room temperature.

There is an earlier post here that describes the touch screen.
http://www.thebackshed.com/forum/forum_posts.asp?TID=5291&PN =4


I found it easier to buy these +/- 50 amp modules rather than make my own.
The only load that doesn't go through the CT is the Slide-out motor which draws 100 amps.



I will have 5 amp sensors on the electric brakes to detect when one axle goes open circuit. This has happened once already and it was not very nice!

I should start assembling the main Maximite control unit soon.

JimEdited by TassyJim 2012-12-17
VK7JH
MMedit   MMBasic Help
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 10:22pm 15 Dec 2012
Copy link to clipboard 
Print this post

Just to correct the picaxe use, the 18X is no longer avaliable (for a while now) and replaced with the 18m2, which will do all the 18X will and more. (same pinouts )
Also ALL the picaxe range in the M2 and X2 range from 08m2 upwards, all have I2C now, meaning you would be hard pressed to purchase any picaxe without I2C.
Although only the X2 range can be used as I2C slaves, the full range can be used as a master

There is a new command format used in picaxe to use I2C, but earlier command formats still work.

One advantage with I2C and picaxe, is it makes no difference which chip you use as the I2C command addresses the 2 x I2C pins regardless of what pin location they are, so a copy paste of I2C code from a 18m2 program to a 08m2 program will work exactly the same.

I have used I2C through 15 meters or more of cable without problems, although the I2C pullup resistors needing reducing to below 1K due the cable resistance between resistors and slaves........So what?

Greybeard,
From what you indicate you want to do, i think a I2C bus system is very suitable for the job, it basically makes slave nodes you add in the area needed to collect the data, ALL these slave just interconnect to a common 4 wire bus.

The bus can be a common parallel row of 4 pin connectors you plug each I2C slave into or a dasiy chain, where one sensor plugs into the other, or both, as its just V0, 5V+, sCL, SDA, all slave connect to the same 4 wires.

Then its just a simple case of calling each slaves address in code when you want data from that slave/node.

Remember the master just reads the slave data when needed or instructed to, otherwise the slave just keeps doing its own thing, this way the slave has collected the data ready for when the master calls for it, meaning less lost time on recording the data, and more time to process/display the information.

Much of what you want to do for your application has already been done by those who log our off grid/ house systems, its just a difference of where you connect the device to log data from.


Pete.


Sometimes it just works
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 12:05am 16 Dec 2012
Copy link to clipboard 
Print this post

For what I'm proposing I can't see how you can have a common earth or a common power rail between the sensors without causing issues with bypassing regulators etc.
Consider monitoring the V & I into a MPPT ( or any regulator ) and the V & I out.
If it switches the -ve rail then a common -ve earth will appear as a bypass to the regulator negating it's operation. Exactly the same if you have an potential difference between -ve earth points ( due to a current shunt or cabling impedance ).
If you have a common +ve earth then the same issue occurs with a positive switched regulator or voltage drop between two positive earth points.

If you use isolated current sensors and a single voltage point measurement then you shouldn't have a problem. I don't want to do that.

Yes it is possible to isolate i2c, spi, RS232 etc. To do it at a low cost though I want to use cheap opto's and a a simple cct. Cheap opto's are slow ( as far as SPI and i2c goes ). For a one second sample rate ( realistically far to fast ) of two analog values with a bit of coms overhead is in the order of 5 or 6 bytes. Say 60 bits ( 6 * 10bits ). Than have 5 sensors ( 5 * 60 bits ) = 300 bits, -> i can run as slow as 300 bps and still get the data sampled and recorded without losing any. Pretty simple to do this with std serial coms ( low speed ) and effectively open collector multidrop RS232. It is probably possible to do this with a single simplex coms system.

 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 12:10am 16 Dec 2012
Copy link to clipboard 
Print this post

Jim/ I agree with the Alegro sensors for the current as they provide electrical isolation. The protection is not so much the issue as having common earth paths.

Pete/ I2c is great until you plug the same earth onto either side of a shunt or a regulator, then all the current flows through the i2c earth wiring until the smoke gets out.

 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 12:30am 16 Dec 2012
Copy link to clipboard 
Print this post


Might be easier to explain with a small drawing what I'm saying.
Imagine you are trying to measure the voltage at the solar panel, the battery and at the fridge ( apologies for the fridge symbol ) 2012-12-16_102701_Visio-Drawing1.pdf

You either short out the regulator or the current shunt.
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 02:32am 16 Dec 2012
Copy link to clipboard 
Print this post

So why not have a linear opto on the voltage dividers and measure the opto output with I2C or picaxe keeping every thing isolated.

Why do you need to read voltage at all devices when battery voltage is common to all.
Sometimes it just works
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 02:45am 16 Dec 2012
Copy link to clipboard 
Print this post

  Downwind said   So why not have a linear opto on the voltage dividers and measure the opto output with I2C or picaxe keeping every thing isolated.

Why do you need to read voltage at all devices when battery voltage is common to all.

I'll have a look at the cost/complexity difference for a linear opto circuit vs isolating the communications. Having a central point of measurement does introduce the potential for noise pickup with an analog signal.


One of the fundamental issues is that there is no common reference point. The battery voltage isn't common. The solar panel voltage upstream of the regulator is different to downstream and the load voltage is at the end of a length of cable that has a finite resistance. Yes, you could measure the voltage drop accross the regulator ( in the example cct ) but you're now measuring smaller voltages or making a custom sensor unit with a different input range. I'm trying to avoid customised hardware. If it's all the same I can just plug any sensor unit in where ever it is required.

 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 07:09am 16 Dec 2012
Copy link to clipboard 
Print this post

In many cases isolating the communication lines dont work so well with optos and bidirectional lines.
You can send data one way with an opto but not both ways very easy.

Isolating the voltage sensors is far easier IMO, as all the circuit consists of is the voltage divider controlling the opto led, and the opto transistor with a pullup or pulldown resistor, to give a 0 to 5v range for the micro to read.

This keeps the opto transistor side all to a common 5 volt and common ground circuit.

Its often how it is done to monitor each single cell of a battery bank, because again there is no common ground for all the cells.

Pete.
Sometimes it just works
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 12:49pm 16 Dec 2012
Copy link to clipboard 
Print this post

  Downwind said   In many cases isolating the communication lines dont work so well with optos and bidirectional lines.
You can send data one way with an opto but not both ways very easy.

Isolating the voltage sensors is far easier IMO, as all the circuit consists of is the voltage divider controlling the opto led, and the opto transistor with a pullup or pulldown resistor, to give a 0 to 5v range for the micro to read.

This keeps the opto transistor side all to a common 5 volt and common ground circuit.

Its often how it is done to monitor each single cell of a battery bank, because again there is no common ground for all the cells.

Pete.


I've done a brief search for the voltage sensing with the opto and have only found circuits requiring opamps as well as the special opto's. DO you have any examples you could point me to?

As far as the isolating serial with opto's, I'm a little intrigued as it's pretty trivial to achieve for a simplex master/slave system. Yes it does require two opto's at each node but for low speed coms they can be the cheapest devices. See attached dwg. 2012-12-16_224926_untitled.pdf I've left out a couple of components but the basics are there.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5912
Posted: 01:17pm 16 Dec 2012
Copy link to clipboard 
Print this post

Looking at your diagram, the only area that is difficult is the solar panel voltage.

My choice for isolated voltage monitoring would be a Picaxe reading the voltage and using PWMOUT to drive the opto-isolator. Almost any picaxe would do that.

A simple LC filter on the Maximite side of the opto and that way you can have the full number of analog inputs available for use.
You could scale the PWM to suit the input voltage range of interest so resolution should be OK.

Jim


VK7JH
MMedit   MMBasic Help
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 01:38pm 16 Dec 2012
Copy link to clipboard 
Print this post

My drawing was an example only to show the some of the possible issues. It's not the exact setup. The actual system has -ve rail shunts, several batteries, camper, fridge, lights spread over the vehicle and camper.
What I was trying to do was create a simple, flexible setup that could be used as a 'plug and play' for the sensors without having any issues with how a system was monitored.
Yes I could create a unique solution to each possible issue with sensing. I really really don't want to go down that path. I'm hoping for as generic solution as possible.
If I'm going to add a Picaxe to each sensor I may as well use the a/d available on the pic and digitise both the current and voltage as close to the source as possible and then isolate the digital only signals back to the maximite. And digitising the voltage measurement to PWM would still leave the current sensor as an analog signal coming back to the maximite. Given a choice I'd run a digital signal around a vehicle in preference to an analog signal.

 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 02:53pm 16 Dec 2012
Copy link to clipboard 
Print this post

The opto isolated coms schematic you linked to might be ok with serial but wont work with I2C as data needs to be sent both ways on a single line.

Here is a simple drawing of what i had indicated but you apparently cant find or workout.





Pete.
Sometimes it just works
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 03:21pm 16 Dec 2012
Copy link to clipboard 
Print this post

Thanks Pete.
Apologies that my research wasn't comprehensive enough.

I may not have mentioned it but it is serial that I'm proposing. I've no intention of using i2c.

I did understand the theory of the using an opto but they typically have very limited dynamic range and/or linearity for analog isolation and vary significantly with temperature.
The documentation I have read suggests that there is enough of an issue that there is special opto's and the need for external amplifiers to achieve linearity and range.
http://ruggedcircuits.com/html/circuit__24.html
http://www.rejustors.com/pdfs/Opto-isolation.pdf

If sufficient dynamic range and repeatability between opto couplers is available then it's possible to calibrate the transfer curve of your suggestion in software. I'd be very interested in seeing the results for such a simple circuit.
cheers
Rod

Edited by greybeard 2012-12-18
 
Downwind

Guru

Joined: 09/09/2009
Location: Australia
Posts: 2333
Posted: 04:05pm 16 Dec 2012
Copy link to clipboard 
Print this post

I dont see an opto with photo diodes working well without an amplifier, but a opto with a photo transistor should work without an amplifier.

It would seem time you puchased a few optos and done a little bench testing, although i think you will need to trim each opto circuit to suit the operating voltage you need to monitor to allow better scaled readings, although in most cases there is little need to monitor down to zero volts, for example a 12v battery i would think 10 to 15 volts is all that is needed to be monitored, if its below 10 volts its flat anyway.
Sometimes it just works
 
greybeard
Senior Member

Joined: 04/01/2010
Location: Australia
Posts: 158
Posted: 04:39pm 16 Dec 2012
Copy link to clipboard 
Print this post


If you look at the led vs collector/emitter current curves for a opto there are linear regions at a constant temperature. So a relevant range ( as you have mentioned ) could be found. It isn't a guaranteed parameter for the opto. And unfortunately the transfer curve and LED forward voltage varies noticebly with temperature. With a simple passive current source for the input the effect of temperature on LED forward voltage only increase the impact on the overall xfer curve.

I definitely like the simplicity of the idea but the data sheets indicate that there are issues.
I'll pick up a few opto's anyway so it won't be a big deal to do some proto testing to see how they work out in practice.

As far as a solution goes the variation between xfer curves would negate the plug and play modular sensor approach. Each sensor would need to be connected to a specific a/d channel and/or recalibrated/configured whenever it was setup.
Doing the a/d as close as possible to the source and isolating the serial coms is prefered practise for telemetry systems.

By
 
     Page 1 of 2    
Print this page
© JAQ Software 2024