NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » uart spi i2c which one would work

March 27, 2015
by escartiz
escartiz's Avatar

Hi everyone, I like to display data from 3 mcu's into a single lcd. I already have a 4x40 lcd working with the nerdkit, and currently working on each of the other 3 nerdkits that will need to send the data. What would be the best way to accomplish this?

Correct me if I am wrong but I like to think the one running the lcd will be a "slave" as it wont do anything other then receiving data and displaying it and running a few leds.

the other 3 "masters" have their own different processes. I like to keep power/ground isolated from each other since using a common ground could double the sensing voltages. This masters will only be sending info to be displayed on the slave, no need to communicate between each other or receive from slave other than an ok to send new values.

March 27, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Postive can be separate, but ground should be common among all. Otherwise things may not work as expected and voltages can be vastly different. If you don't connect ground between them, then there is no commonality of voltage-- no reference. And voltage is a relative thing.

Ground could be +35V on one, -14V on another and 0V on the 3rd. Voltage is relative to ground- but ground isn't reference to anything (so may be anything). Once you connect ground among them, then they all know that ground is (relatively speaking) zero. -- And thus is another reason ground is sometimes referred to as 'common' because it's common among all.

And if you think about appliances in your home, they are all referenced to the A/C power ground. Common ground.

As for communication-- I'd just use serial. Very little overhead, very easy to work with, and easy to confirm with a scope. Code examples exist on the forum.

BM

March 28, 2015
by escartiz
escartiz's Avatar

I understand that common ground is important but in this case each of the 3 devices will do its own process, no need to communicate between each other, it is the one that handles the lcd display that will receive text from the other three and just display it in the same screen. It is only for monitoring under the same large screen instead of using 3 different lcds which would be the easiest way. Perhaps a wireless transmission to the lcd from the other 3 mcus????

Here is the problem about using common ground, One of the many things that each of the three mcu's will do is to measure individual cell voltages from a large battery pack, the pack cells in series will be divided in 3 sections, and each mcu will monitor each of this sections.

I am going to use resistors to divide voltage, currently thinking in using a 1M and 100K so that I can read up to 50v per section, since each mcu has only 1024 steps measuring any higher voltage would end up giving me less accurate measurements since I won't have that many steps to do the math. Starting to measure with mcu #1 at the negative side of the Battery pack (ground) and compering cells up to 50vs, then mcu # will read another 50volts, and so on for mcu #3 for a total of 150v.

If I was to use a common ground then the very first measurement for mcu# 2 would start at over 50v and #3 over 100v and that leaves me with less accuracy. I like to have as many steps as possible to keep readings more precise. Since there are 1024 total, for each 50v section consisting of up to 12 cells, I could have around 85 steps to compare between each cell. Using a single mcu to read the whole pack would only leave me around 28 steps between each cell.

In other words, for this to work like I am planing. 50v for mcu #1 is actually ground for mcu # 2, and ground for mcu#3 is actually up to 50v for mcu#2. That is why I need to isolate.

I think this is a bit confusing to explain. Let me know if a drawing would help understand my idea better.

March 28, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

I believe I understood your explanation-- but a schematic would be great.

With your suggested resistor values, your highest ADC reading will be around 930 with a 5V reference. Instead of 100K-Ohm, Try 110K-Ohm if you can, that will get you up to 1014 or so. 120K-Ohm is too high.

The part that isn't clear is your simultaneous connection from all 3 readers to your single display device, because that's where you could run into 'common' problems. You could use wireless, or even get isolation using a 4N35 for example (that's how we solve the isolation issue for our power-monitoring circuits)-- and this would solve that issue.

Good luck. Looking forward to seeing your completed project.

BM

March 29, 2015
by sask55
sask55's Avatar

I think there are at least two possible approaches to monitor voltage levels on the groups of batteries in series as you have suggested.

Approach A:

As you have suggested you could use the ADC on a different MCU on each group of batteries to do the convention form the analog battery voltage to digital output. In this scenario you would require one MCU for each set of battery units you wish to measure.

You could power the MCU’s from the battery sets and isolate the units from each other with optical isolators. Since the data communication between MCUs is digital I would suggest using high speed Schmitt trigger type optocoupler chips like the H11L1M-ND. I have had great successes using these chips to totally isolate the PC USB port from the Nerdkit board (no common ground, power, or signal connections) and maintain serial communications. I had a number of problems setting up that serial communications when I was trying to do it the 4N35 optocoupler.

I don’t think there is any reason the ADC on the mater cannot handle one of the battery groups being monitored as well as display the results from the slave chips monitoring the other battery groups. In order to divide the total battery series into three groups you would require three MCU chips one as the master two as slaves. I believe you will also require three voltage regulators to supply power to MCUs from the battery groups being monitored. SPI communication would require a SS connection, a MOSI connection to initiate each data byte transfer from a slave and a MISO connection to transfer data from the slaves to the master. Therefore you will require six optocoupler chips. That is using SPI.

I could post a very rough schematic showing the values of the current limiting resistors and the connections required to set this up. Keep in mind the optocoupler I have suggested are inverting, this would be handled in the software.

This approach has a considerable amount of hardware and software to develop. I think it would work well and be as accurate with a high degree of resolution. The signals are digital and not likely to be degraded by noise on the communication lines.

Approach B:

Handel all the ADC from just one MCU. In this scenario I would consider using High-linearity analog optocouplers to isolate all but one battery group from the MCU. Using this type of chip would allow the analog signals to be delivered to any one of the 6 ADC pins on the MCU while maintaining total electrical isolation. Something like the HCNR201 may do the trick for you. I have never used this type of chip but I believe your application would be the typical application for such chips. This approach would require that you make analog isolator circuits for each input as shown in the data sheet. All the signals would be analog and subject to noise and interference.

Anyways; that is a couple of ideas.

Darryl

March 30, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Also, the ADC sets the specification for what components you interface to it, so check those specifications carefully. I didn't know which MCUs you're using, so don't know which datasheet to reference.

BM

Post a Reply

Please log in to post a reply.

Did you know that negative numbers are represented in two's complement notation in binary? Learn more...