Stepping Voltage??

buntay

Senior Member
#1
Hello all, buntay again with a question that I am not completely sure about.

Application: I have a coal bin I would like to monitor the level of. I am planning on using 10, evenly spaced, 6-30Vdc PNP capacitive prox sensors and will be powering them with 12V.

Problem: I would like to use 1 input pin of a 20X2 as an adc to get the level based on the different voltages.

Now, I am sure this is possible by using a voltage divider in series setup but what I am not sure of is what this schematic would look like. Now I dont need values of the resistors unless someone would like to provide them...hahaha. could someone post what this schematic would look like?

Thanks
F.
 

AllyCat

Senior Member
#5
Hi,

Application: I have a coal bin I would like to monitor the level of..
So you want to measure the level of coal? What are the dimensions/shape/material of the bin? Have you tested that those sensors can make a useful/reliable measurement of the level?

Personally, I would have thought that an ultrasonic or optical method might be more satisfactory. But if each sensor (equally spaced from bottom to top) does give a simple "logic 1" voltage output when it is "covered", then all you need to do is connect each 0/1 logic level (ground/supply) via a suitable resistor value (perhaps 10k) to An ADC input pin. If the "logic" output level is higher than the PICaxe's ADC reference voltage (supply rail) then add another resistor from the ADC input to ground (perhaps 1k).

Cheers, Alan.
 

premelec

Senior Member
#6
Whereas the R-2R network is quite accurate you likely can in this instance when you are sensing top level you can use weighted resistors to a common smaller resistor on the ADC input... as AllyCat suggests there may be problems with coal dust, lumps etc... if you have a bin on a load cell and go by weight that likely would be a more certain reading... whatever works!
 

Pongo

Senior Member
#7
I don't think it even needs weighted resistors. All we need to know is how many sensors are detecting coal so use the same value resistor for each sensor commoned to the ADC input with another resistor to the other rail. Like other posters, I question whether this is the right type of sensor for the job.
 

buntay

Senior Member
#8
Thank you all for the insight and issues i may run into. I will try to address them now.

1: As to the size and dimension, please see photo. http://www.dccguy.com/?p=3125

2: I did think about optical but thought i may run into the dust issues moreso than the proximity sensors

3: the reason I was hoping to go the proximity sensor route cause I could easily remove and clean them when they did start giving wonky readings.

4: If I could use the weight sensor idea, I would love to, however, the bin is 25 feet high and 9 feed round. based on some other bins I have it works out to about 16 tons. I dont know of any cost effective way to make that work.

Again thanks to all for your help so far :)

F.
 

The bear

Senior Member
#9
Hi buntay,

Originally Posted by buntay: the bin is 25 feet high and 9 feed round. based on some other bins I have it works out to about 16 tons.
Were you expecting to refuel the Titanic?
Good luck with your sensors.

Regards, bear..
 
Last edited:

hippy

Technical Support
Staff member
#10
the bin is 25 feet high and 9 feed round. based on some other bins I have it works out to about 16 tons.
Not quite what I was picturing :)

I would suggest the project is probably leaning so towards mission critical that it would likely make sense to read each sensor individually rather than mess about with ADC ladders, adding complexity and additional points of potential failure.

Having 10 digital sensors is easy to handle for a 20X2. I am not even convinced a 10-sensor ADC ladder would work well with a 10-bit ADC though you could use two 5-sensor ladders.

I am not certain why you desire a single ADC but if it's just to cut down on wiring I would suggest putting the PICAXE where you would have put the resistor ladder and have that send out a serial signal which can be read by another PICAXE in the monitoring station. Or 'Head Orc's Office' as is running through my mind :)
 

AllyCat

Senior Member
#11
Hi,

Your application is sufficiently "unusual" that it's probably necessary to do some tests. In particular, I have some doubts about the suitability of the sensor linked in #3 (and its .PDF specification there). The "range" is described as 10 mm and the detection object as "Iron 50 x 50 x 1 mm" which may not correlate very well with "lumps of coal". I believe the detected material needs to be electrically conducting (but not necessarily of very low resistance) and presumably coal is primarily carbon. The principle of operation of a carbon granule microphone was the changing resistance (and hence current) when carbon particles were pushed together (by sound pressure waves), but I don't know how that might bear on the function of carbon as the "proximity" material.

However, the size of your hopper is such that maybe the coal can be considered to behave as a "powder" or even loosely as a "fluid". Thus you may not need the weigh the whole contents of the hopper but only the "pressure" (i.e. weight/unit area) at the bottom. Thus a pressure plate (perhaps up to a foot square) mounted on a load cell inside the base of the hopper might be sufficient to give a good analogue value. Of course you would need to know the average density (i.e. weight/unit volume) of the coal, but that would apply to any weighing method.

Cheers, Alan.
 
#12
I think that, if it were me, I'd just use a simple ultrasonic range module fitted to the top of the hopper, as previously suggested. Ultrasonic modules are easy to interface to a Picaxe and the coal bin is likely to be large enough so that unwanted reflections from the sides are unlikely to cause any problems. An ultrasonic module would also be cheap and easy to replace, without disturbing the coal bin contents, if it ever failed. If you need it to be more weatherproof than the standard cheap modules, then I've found that you can use waterproof reversing sensor transducers, the ones that are tuned for 40 kHz, in place of the non-waterproof ones fitted to these modules as standard.

I've also found that these modules work just fine with the sensors mounted remotely on twisted pair leads. I've used one of these modules (like this SRF05: http://www.picaxestore.com/index.php/en_gb/picaxe/add-on-modules/srf005.html ) with the sensors un-soldered from the module and fitted to the end of twisted pair cables around a metre long, and the module still worked just as well as when the sensors were on the PCB. Remote mounting may well increase the range of options for fitting the sensors.
 

rq3

Senior Member
#13
I think that, if it were me, I'd just use a simple ultrasonic range module fitted to the top of the hopper, as previously suggested. Ultrasonic modules are easy to interface to a Picaxe and the coal bin is likely to be large enough so that unwanted reflections from the sides are unlikely to cause any problems. An ultrasonic module would also be cheap and easy to replace, without disturbing the coal bin contents, if it ever failed. If you need it to be more weatherproof than the standard cheap modules, then I've found that you can use waterproof reversing sensor transducers, the ones that are tuned for 40 kHz, in place of the non-waterproof ones fitted to these modules as standard.

I've also found that these modules work just fine with the sensors mounted remotely on twisted pair leads. I've used one of these modules (like this SRF05: http://www.picaxestore.com/index.php/en_gb/picaxe/add-on-modules/srf005.html ) with the sensors un-soldered from the module and fitted to the end of twisted pair cables around a metre long, and the module still worked just as well as when the sensors were on the PCB. Remote mounting may well increase the range of options for fitting the sensors.

All of these sensors are fun, but might be inadequate or overkill. How about a long arm on a potentiometer that feels the surface of the coal pile? As the coal level drops, so does the arm, and the pot rotates. Or perhaps a plate on a string wrapped around a potentiometer shaft. The plate rests on the coal pile, and the string turns the pot as the pile settles. You'd have to make sure the arm or plate was out of the way during a coal fill-up, but other than that?

If the idea of a mechanical pot is unsettling with all the conductive coal dust, perhaps a rotary magnetic sensor, with the magnet on a shaft, and a bit of Picaxe code. That could have infinite depth if the string were infinitely long ;-)

EDIT: Just did a search on the InterWebs for "silo measurement" and found this, which goes into methods, accuracy, and cost:
https://www.monitortech.com/webseminar/WebSeminar_Dec04.pdf
 
Last edited:

Flenser

Senior Member
#14
Buntay,

Looks like an "R2-R DAC" may not be a simple solution for you, at least not with 10 capacitive sensors.

The following comment about the required accuracy for the resistors from the Wikipdia page https://en.wikipedia.org/wiki/Resistor_ladder
On a printed circuit board, using discrete components, resistors of 1% accuracy would suffice for a 5-bit circuit, however with bit counts beyond this the cost of ever increasing precision resistors becomes prohibitive. For a 10-bit converter, even using 0.1% precision resistors would not guarantee monotonicity of output.
 

AllyCat

Senior Member
#15
Hi,

The OP is proposing 10 equally spaced (logic level output) sensors and will only detect one of 10 (or strictly 11) levels, so IMHO an R-2R or weighted-resistors DAC is not appropriate. The only configuration which might need weighted resistors is if each sensor has a "changeover switch" output, such that it disconnects all the other resistors higher (or lower) in the chain.

Personally, I don't see that an "arm" would fit into a silo 25 feet high and only 9 feet across (around?) or how a plate could be conveniently moved away during filling (which is also when the level measurement actually might be required). But we really need to know the method of filling the silo with coal and whether the top of the coal is ultimately level (horizontal).

So I'm with Jeremy, the ultrasonic sensors used for automobile reversing sensors must be able to tolerate the grit, etc., thrown up from the road, so should tolerate coal dust. However, I believe the cheap "off-the-shelf" ultrasonic range sensors are "gated" to a range of significantly less than 25 feet, so it might be necessary to devise a custom design. But the time-of-flight delays are well within the capabilities of a PICaxe (50 feet round trip = 50 ms). Additionally, several sensor/systems might be used (for redundancy/accuracy), particularly if the top surface of the coal is not always level (horizontal) within the silo.

Cheers, Alan.
 

buntay

Senior Member
#16
Thank you all for the insight.

There were a lot more things I did not take into consideration so here is where I am at.
instead of using the input pin as an ADC I will use it as a regular input pin that will be used to see if the furnace is running. This will actually work better cause now I will be able to see if the furnace is running remotely. So, since the feed rate of the furnace never changes all I need to do is the first time the bin is filled I will need to time how long it takes to empty, work that into the coding and just count backwards. The only question I have is how stable is the clock speeds of a 20X2? I know I will need to use some eprom writing to hold the numbers in the event of a power outage or reset.

Knowing how much coal burn in an hour and running the calculation every hour will give a close enough resolution to make sure I dont run out.
 

rq3

Senior Member
#18
Hi,

The OP is proposing 10 equally spaced (logic level output) sensors and will only detect one of 10 (or strictly 11) levels, so IMHO an R-2R or weighted-resistors DAC is not appropriate. The only configuration which might need weighted resistors is if each sensor has a "changeover switch" output, such that it disconnects all the other resistors higher (or lower) in the chain.

Personally, I don't see that an "arm" would fit into a silo 25 feet high and only 9 feet across (around?) or how a plate could be conveniently moved away during filling (which is also when the level measurement actually might be required). But we really need to know the method of filling the silo with coal and whether the top of the coal is ultimately level (horizontal).

So I'm with Jeremy, the ultrasonic sensors used for automobile reversing sensors must be able to tolerate the grit, etc., thrown up from the road, so should tolerate coal dust. However, I believe the cheap "off-the-shelf" ultrasonic range sensors are "gated" to a range of significantly less than 25 feet, so it might be necessary to devise a custom design. But the time-of-flight delays are well within the capabilities of a PICaxe (50 feet round trip = 50 ms). Additionally, several sensor/systems might be used (for redundancy/accuracy), particularly if the top surface of the coal is not always level (horizontal) within the silo.

Cheers, Alan.
Well, I can design an "arm" that fits the required silo, and turns a pot. The OP doesn't specify how much extraneous space he has, so without more information it's moot. We don't even know if the coal bin is normally covered after filling. Heck, a simple pulley and rope with a weighted "probe" would suffice. I was just throwing out suggestions that were cheap, easy, do-able, and didn't involve radar, sonar, lidar, capacitance sensing, or load cells. What the heck. If the coal bin has a lid, he could put a 25 foot long bamboo pole through a hole in the top. When the bamboo disappears, the bin is empty. Some aircraft fuel indicators work this way.

A brief search indicated that it's common to measure the contents of powder or granular content silos with a plumb bob arrangement on a rotary encoder. My reference to a "plate" was something along the lines of a pie-plate, not a sliding lid that covered the entire surface of the contents of the silo. But hey, if silo owners have been using a pie plate on a string for 100 years, I'm happy to throw it out there.

Often experimentors can't see the forest for the trees, and a reality check regarding what it is they are REALLY trying to do is of help. The OP seems to have figured that out for himself, in a rather ingenious manner. He has X coal. He consistently burns Y coal per hour. He will run out of coal after X/Y hours.

The point is that he looked at the issue from a different perspective, and the tried and true methods are usually tried and true for a reason. They have worked, economically, for long enough to remain economic. "High Tech" does not necessarily, indeed usually doesn't, equate to "better". Unless you're living at the quantum level, humans live in an analog world. Translating that to discrete digital bits, and then back to analog representations of those digital bits for humans to see, hear, feel, smell, touch, or otherwise experience leads to weird things, like the world we are all trying to live in today.

I think a lot of students are being trained to think that "coding" a problem "solves" the problem. The problem is that they can't define the problem, nor the repercussions of their fix. I'd apologise for the philosophical discourse, but won't, since the entire discourse is a huge problem, and not a subject for this forum.
 
Last edited:

tmfkam

Senior Member
#19
Well, I can design an "arm" that fits the required silo, and turns a pot. The OP doesn't specify how much extraneous space he has, so without more information it's moot. We don't even know if the coal bin is normally covered after filling. Heck, a simple pulley and rope with a weighted "probe" would suffice. I was just throwing out suggestions that were cheap, easy, do-able, and didn't involve radar, sonar, lidar, capacitance sensing, or load cells. What the heck. If the coal bin has a lid, he could put a 25 foot long bamboo pole through a hole in the top. When the bamboo disappears, the bin is empty. Some aircraft fuel indicators work this way.

A brief search indicated that it's common to measure the contents of powder or granular content silos with a plumb bob arrangement on a rotary encoder. My reference to a "plate" was something along the lines of a pie-plate, not a sliding lid that covered the entire surface of the contents of the silo. But hey, if silo owners have been using a pie plate on a string for 100 years, I'm happy to throw it out there.

Often experimentors can't see the forest for the trees, and a reality check regarding what it is they are REALLY trying to do is of help. The OP seems to have figured that out for himself, in a rather ingenious manner. He has X coal. He consistently burns Y coal per hour. He will run out of coal after X/Y hours.

The point is that he looked at the issue from a different perspective, and the tried and true methods are usually tried and true for a reason. They have worked, economically, for long enough to remain economic. "High Tech" does not necessarily, indeed usually doesn't, equate to "better". Unless you're living at the quantum level, humans live in an analog world. Translating that to discrete digital bits, and then back to analog representations of those digital bits for humans to see, hear, feel, smell, touch, or otherwise experience leads to weird things, like the world we are all trying to live in today.

I think a lot of students are being trained to think that "coding" a problem "solves" the problem. The problem is that they can't define the problem, nor the repercussions of their fix. I'd apologise for the philosophical discourse, but won't, since the entire discourse is a huge problem, and not a subject for this forum.
I like your thinking!

Personally I like to spend some time breaking a problem down into it's simplest component parts, this makes any solution simpler to implement which in turn should lead to more reliable results.

Over complicated solutions are often expensive and not always better.

Though if a more complex solution leads to an elegant and perfectly symmetrical circuit board, then I'm torn between the two!
 

AllyCat

Senior Member
#20
Hi,

The only question I have is how stable is the clock speeds of a 20X2? I know I will need to use some eprom writing to hold the numbers in the event of a power outage or reset.
The PICaxe clock stability is better than +/- 1% so probably more accurate than the feed rate. It can be trimmed a little with the CALIBFREQ command if required and is probably stable to a fraction of a percent, except with extreme variations of temperature or supply voltage.

Yes, storing the present value in the PICaxe's EEPROM is a good idea. Once per hour is probably about right, that's just under 10,000 writes per year (24 x 365) so the PICaxe should be good for at least 10 years. ;)

There might still be some questions around the: "a regular input pin that will be used to see if the furnace is running".

----

Personally, I normally try to answer the specific question(s) asked, but it can be difficult when it seems to be the "wrong" question; and I'm also a great believer in KISS. Very often, threads start with a "solution" when really what is needed is a description of the "problem", or even better a "specification" (but these are about as rare as hen's teeth). My assumption was that a "fully-automated" solution was desired, but it seems that a "long duration egg-timer" meets the bill. :) [Please note the Smiley].

Cheers, Alan.
 

hippy

Technical Support
Staff member
#21
The only question I have is how stable is the clock speeds of a 20X2?
Whenever I've used a PICAXE with an internal oscillator its timing has been bang-on when I've looked at hardware output with a logic analyser.

I would say it's probably going to be 'good enough' and, if worried it might not be, just choose a 28X2 instead and use an external resonator.

It can be false economy to try and minimise costs when something is just a small part of a project and the savings pretty minimal.

Though I'm not entirely sure that PICAXE clock accuracy matters much. I would have expected you to be using a battery backed-up RTC for timing so you can handle loss of power and missed time easily.
 
Top