What circuit can do this

Thread Starter

BBQ

Joined Jan 22, 2014
23
Some more help needed Plz.....I have a 10 sensors constructed and now working operating between 9v to 12v what I'm looking to do is sequentially go through each sensor every 10 seconds or so to sample the state of that sensor,the circuits are based around the LM393....could a 4017 do this and stop at the sensor which has a high output or do I need something more elaborate.


Another question...I have a PID Controller that uses just one switch to change the temperature settings, how can one switch control so many functions ? what types or names of circuits can do that so effectively.

Cheers thanks.
 

crutschow

Joined Mar 14, 2008
34,464
It's fairly simple to go through the 10 sensors with a multiplexer controlled by a counter, but if you need to stop at the highest value, then the simplest way to do that is likely with a mircrocontroller as GT suggest. Every done any programming?

A PID controller has feedback from a temperature sensor the the controller. You just change the feedback setting to change the temperature.
 

Thread Starter

BBQ

Joined Jan 22, 2014
23
crutschow I did some programming some 10 years ago... any info on good tutorials as I would like to get into the PIC programming...cheers
 

anw

Joined Jan 11, 2014
10
I'm not sure how helpful this will be, since what I did didn't work, and I don't know what kind of heater you're using, but here goes...

I built the internet-ubiquitous reflow oven (morphed a toaster oven), and attempted to implement a PID to control it. The concept was to use the PID to control the duty cycle of a PWM signal to the relay that powered the heating elements. I screwed around with it for a while, and never could get it quite right. I super-insulated the oven with refractory-grade insulation, so it would tend to overshoot pretty wildly. I wound up just using a dead band: once you're "in the zone", then when the temp hits 2 deg below the set point, turn on the relay; when it hits the set point, turn it off. Works well, has some jitter, obviously, but the mega-insulation saves me and once it gets in the dead-band range it doesn't cycle too wildly. I used a Raspberry Pi as a controller, and built the thermocouple/power circuit loop the Pi controls.
 

crutschow

Joined Mar 14, 2008
34,464
crutschow I did some programming some 10 years ago... any info on good tutorials as I would like to get into the PIC programming...cheers
I'm sure there are and a Google search will come up with many, but I not that familiar with them to provide a recommendation.
Perhaps someone else can help with that.
 

Alberto

Joined Nov 7, 2008
169
Are your sensors working with logic conditions (low/high) or you need to read the voltage value of each. In the first case you have no problem in selecting the correct MCU all you need are 10 I/O, in the second instance you will need an MCU with 10 analog inputs.

Cheers

Alberto
 

elec_mech

Joined Nov 12, 2008
1,500
Could you elaborate more on what you want the circuit to do?

So far,

10 sensor outputs (as Alberto asked, is the output binary: 0V or 12V, or analog 0 . . 3.4V . . . 7.1V . . . 12V?)

How do you want to indicate which sensor is high? An LED for each sensor so when a sensor is tripped the corresponding LED stays lit?

Do you then want a reset button to resume scanning or will the tripped sensor clear itself when you do whatever needs to be done?

Assuming a binary output, you could do this with a 555, a CD4017, and some AND gates. The 555 sends a clock pulse to the 4017 every ten seconds. The corresponding 4017 output is then fed to a 2-input AND gate and the second input comes from the corresponding sensor. If the sensor is high, the AND gate output goes high, lights an LED, and pauses the 555 through the reset pin. A button could be added to resume the 555 or, if the sensor goes low again, it would enable the 555 again.

If you need an analog value, e.g., indicate a sensor is tripped above or below a specific value such as 6.8V, then you'll need a microcontroller. As you mentioned PIC, you can use the PICkit 3 and a free version of C available through Microchip. Alternately, since you don't need super accurate millisecond timing, you could use a PICAXE microcontroller with BASIC. The PICAXE would be cost less to get started but it has its limitations if you decide to really get into microcontrollers.
 

Thread Starter

BBQ

Joined Jan 22, 2014
23
Thank you all guys....I'm gonna explore the PICkit3 got them on fleabay 20 squids...the programming looks quite easy but that would be dependent on the complexity of the application I would say.

I have taken what you posted onboard elec_mech I'm going to think on that one and thanks again.
 

elec_mech

Joined Nov 12, 2008
1,500
I can put together a schematic of the hardware solution if you decide you want to go that route.

As for the PIC solution, you'll end up having less parts which is never a bad thing and learn to program! I can't say I've got much experience in C programming, but there is a free version of BASIC for the PIC limited to specific PIC microcontrollers found here if you're interested. Good luck!
 

Thread Starter

BBQ

Joined Jan 22, 2014
23
elec_mech would you do the schematic if not to much trouble as I could construct it while in the meantime venturing into the PICkit3....Is there anything else I may need besides the PICkit3 you can think of to get me going with PICS.

Cheers

Thanks
 

elec_mech

Joined Nov 12, 2008
1,500
Can do . . . did you want the circuit to operate as I described in post #8? Ten LEDs, one per sensor to indicate which sensor tripped? Is the sensor output binary/digital (either 0VDC or 12VDC, not something in between)?

I'll have to give the PIC some thought. You'll need the basics like a breadboard, jumper wires, some resistors and LED's. Otherwise, nothing too special. Whether the sensor outputs are digital or analog, you'll need some type of voltage divider as a PIC won't want anything higher than 5VDC. You could make a ULN2004 with ten pull-up resistors work or you could use 20 resistors to make ten voltage dividers. Someone else may have a more elegant solution.

You could add a piezo buzzer if you'd like some audio alert. Of course, this can drive others nuts, so it depends on the importance of whatever the sensors are monitoring and how soon someone needs to react to it.
 

Thread Starter

BBQ

Joined Jan 22, 2014
23
Yes elec_mech binary outputs with an led on each sensor the operating voltage will be 12v

I have all the equipment necessary,soldering stations,bench power supply,breadboards + Power Supply Module Adapter Board t 3.3V 5V,Jumpers and fairly decent store of components, the only thing I don't have is an oscilloscope which I will have to become familiar with...I spent all my beer money lol on my workshop as I have only been doing electronics some 10 months.

I also have a variety of buzzers to use as an audible as well as visual indication which is desirable...just another quick question though there is no reason why the ULN2004 couldn't be cascaded is there ??? Erm for something else I'm working on.

Cheers

Thanks
 

elec_mech

Joined Nov 12, 2008
1,500
Okay, here are a couple of ideas. I may have over-engineered these, so you may be able to lose a few parts.

For the purely hardware solution, I added some ULN2004 to provide more current to the LED's as the AND gates can't supply more than a mA or two if I'm reading the datasheet correctly. When the corresponding 4017 output goes high, if a sensor is tripped (outputting 12VDC), the corresponding AND gate will go high allowing the corresponding ULN2004 output to go low. This turns on the corresponding LED and pulls the reset pin of the 555 low, effectively stopping the clock signal. I didn't add a manual switch, so the clock will only resume once the tripped sensor output goes low again. A switch could be added though. I didn't know if the sensors output a true low signal when not tripped or if they float, so pull-down resistors are added to the sensor inputs to prevent false triggering.

For the microcontroller (uC) solution, I picked a PIC16F886 which will work with C or the BASIC program I mentioned. Instead of using ten LED's, I added a 7-segment display. This requires less pins and allows you to more readily identify the tripped sensor. I've connected the decimal point (DP) as well - you could have the PIC blink the DP every ten seconds just to verify everything is up and running. Again, pull-down resistors are added to the sensor inputs just in case. It's been awhile since I played with PIC's, but they may have an option in software to use internal pull-up resistors which would eliminate the need for R11-20. Also added a piezo for an audio alert. Piezo's often need more voltage than the uC to get any decent sound, so a transistor is added allowing you to use your 12VDC to power it. Also note a piezo will require a PWM wave of some sort. Alternately, you could use a buzzer which operates simply by applying power (no PWM signal needed).

Hope this helps. If I made a mistake, hopefully someone else here will catch it and I'll make any needed corrections.
 

Attachments

Alec_t

Joined Sep 17, 2013
14,330
Pin 5 of the 555 should have a cap (e.g. 100n) to ground for stability.
The 555 reset level (pin 4) can be as low as 0.3V according to the datasheet, so you may have problems using the ULN2004 to pull it low enough via a diode. If so, perhaps pull pin 7 down instead (and omit R3)?
 

elec_mech

Joined Nov 12, 2008
1,500
Pin 5 of the 555 should have a cap (e.g. 100n) to ground for stability.
I typically don't add it because I haven't had a problem in the past, but you're right, it's a good idea to include.

The 555 reset level (pin 4) can be as low as 0.3V according to the datasheet, so you may have problems using the ULN2004 to pull it low enough via a diode.
I wasn't aware of that. :eek: I learn something new here all the time. :)

Since we have a couple of extra AND gates and they have a much higher low voltage input rating, I'm feeding the 555 clock signal and the LED on signal through one. With the LED's off, the AND gate will go high whenever the clock signal goes high. When an LED is lit, the AND gate will go low and clock signal will not go to the 4017.
 

Attachments

Thread Starter

BBQ

Joined Jan 22, 2014
23
That is a fine job indeed elec_Mech and fully appreciated,I must convey this to my breadboard and sample it,but why for 1uf C3 across the 555 ?...the newbie strikes again.

I'm also very curious about pin 5 of the 555 stability factor as mentioned by Alec-T ....why should some circuits keep Pin 5 floating and others not ....

Cheers

Thanks
 
Last edited:

elec_mech

Joined Nov 12, 2008
1,500
I must convey this to my breadboard and sample it,but why for 1uf C3 across the 555 ?
Firstly, CMOS IC's generate noise which why we have a 0.1uF on every CMOS IC, i.e., 4017 & 4081. Adding these as close as possible to the Vcc and GND pins of these IC's helps eliminate this noise and avoid false triggering, etc.

I had to do some looking up on the 555. I remember SgtWookie, our resident Expert Member, telling me the importance of having two capacitors on 555's, but I couldn't intelligently remember why. Take a look at post #8 here and this post.

In a nutshell, the 555 is noisy, hence the need for a 0.1uF. The 555 also momentarily creates a short across Vcc and GND whenever it changes state which can negatively impact other IC's or circuits. Hence the need for the 1uF. As SgtWookie pointed out in one of the linked posts above, take a look at page 12 under Additional Information of the TI datasheet.

I'm also very curious about pin 5 of the 555 stability factor as mentioned by Alec-T ....why should some circuits keep Pin 5 floating and others not ....
It's not that some circuits should keep pin 5 floating. You just want pin 5 to be stable, otherwise the 555 may not operate as you expect it to. More info in the linked posts above. I typically leave the capacitor off pin 5 only because I haven't had a problem without it. However, I'm usually just prototyping or testing a circuit out here or there, not putting it into regular service. I really should always include one to be safe to eliminate any potential problems. If you have noise on the circuit or from the power supply and pin 5 is floating, it could cause problems and it may not be obvious the problem is a floating pin 5. Worse, it could lead to intermittent problems making you think you got a bad batch of 555's.

Thanks to Alec_t for keeping me honest. :)
 

Thread Starter

BBQ

Joined Jan 22, 2014
23
Thanks for the time making my circuit elec_Mech I will be away fishing the weekend so I will give the circuit a whirl monday evening....




Cheers

Thanks
 
Last edited:
Top