Author Topic: What do these Resistors do?  (Read 4701 times)

0 Members and 1 Guest are viewing this topic.

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
What do these Resistors do?
« on: January 12, 2012, 09:50:49 am »
I´ve been given a control board from a spa.  Basically it does 2 things, first checks that the water level is high enough in the spa and second, starts and stops the pump from a water proof push button.  The push button and water level sensors are broke.  I got a new sensor and made a new board and the spa is working again.  However, now i´ve got the old board I´m currious how it actually works.  I´ve drawn a schematic from the board (see below) and I understand everything except what the point of resistors R1, R2, R3, R7 is and why R4 is such a high value.  They seem to me to configured as voltage dividers, but why? 



Uploaded with ImageShack.us

PL1 = Mains in (230v)
PL2 - Supply for pumps (230v)
PL3 = Water Sensor (optical I think)
PL4 = Push Button to start/stop

I have never dealt with PIC´s before, but the idea seems to be much the same as the Atmega chips, which I have dealt with.  So i get how the inputs and outputs works, infact that part of the circuit is the same as the one I built.  I just don´t understand the resistors.

Any help wouyld be appreciated.

Many Thanks 

 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: What do these Resistors do?
« Reply #1 on: January 12, 2012, 09:59:45 am »
now just as a guess, being how you didnt say where the sensor connected, i would have to guess its acting as a weatstone bridge (few odd resistors in the middle) but i think it works by using GP4 and 5 as a comparitor (have not looked at device datasheet and may be wrong)

 

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: What do these Resistors do?
« Reply #2 on: January 12, 2012, 10:22:59 am »
The sensor connects in to PL3.  I think, but I´m not 100% sure, that the sensor is digital and basically works as a switch.

According to the datasheet, all the GP´s are digital I/O´s, but can be used for other things, such as clocks and programmming.  But in this case I´m fairly sure they are just digital i/o´s.

 

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: What do these Resistors do?
« Reply #3 on: January 12, 2012, 02:40:00 pm »
Had a bit of a probe around the circuit and found my "trap for young players".  The transformer is labeled as 230v primary and 6v secondary.  However, it is acutally 12v secondary, therefore the sensor input is 12v not 6v that originally thought.  There are only 2 pins on the secondary side of the transformer, but I assume it must be wired in series somewhere to get the 12v.

So do the resistors drop the voltage back down to a reasonable voltage for the PIC and thats it?

 

Online amyk

  • Super Contributor
  • ***
  • Posts: 8241
Re: What do these Resistors do?
« Reply #4 on: January 13, 2012, 11:00:22 am »
The ones connected up to +5V are pull-up resistors, and the ones connected in series with the input limit the current.
 

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: What do these Resistors do?
« Reply #5 on: January 13, 2012, 11:47:26 pm »
Thanks, but I am still not 100% clear.

I get R1 being a pull-up, no problem there. So with R3 being current limiting, does that make the PIC sense that the optical switch has pulled low and use that as it´s reference? 

The bit I really don´t get is R4 and R7.  R4 is a 120K pull-down resistor and R7 a 2.2K pull-up, why have both?

If both inputs (the optical sensor and push button) are both essentially switches, is there a reason why the current limiting resistors are different values?  Surely the current would be the same?

thanks again
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: What do these Resistors do?
« Reply #6 on: January 14, 2012, 12:00:40 pm »
So with R3 being current limiting, does that make the PIC sense

R3 will limit the current into the PIC pin offering protection from high transient voltages on the input. 

The bit I really don´t get is R4 and R7.  R4 is a 120K pull-down resistor and R7 a 2.2K pull-up, why have both?

R4 doesn't make much sense, 87k for R2 is not a standard value either so I think you might have some mistakes in the circuit.
 

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: What do these Resistors do?
« Reply #7 on: January 18, 2012, 09:41:39 am »
You were right R2 should read 47K, which now makes much more sense to me.  So the only thing I am now not clear on now is what R4 is supposed to do.  Since it doesn´t make sense to you either, I feel a bit happier about that.  I double checked and the schematic is definitely right and the value is 120K.

I gave the board a try to see if works and it does.  Pin 2 on the sensor (PL3) has to be pulled low, and when the switch is made on PL4 the relay starts.

Just one more question, more curiosity really.  How critical is that the resistors R2 and R3 have to be 47K?  Would there have been a calculation to get these values, or would it have been more of an educated guess?

thanks

 
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2095
Re: What do these Resistors do?
« Reply #8 on: January 18, 2012, 12:15:25 pm »
Just one more question, more curiosity really.  How critical is that the resistors R2 and R3 have to be 47K?

For protection the higher the better but limited by the capacitance of the pin and PCB traces making a RC low pass filter if speed is important and leakage of the pin and PCB traces producing a dc offset.

PIC pins leak about 1uA but a PCB if it is a bit dirty could leak more. PIC pin diode clamps are typically rated at 20mA absolute max so with 47k you can theoretically put nearly 1kV on the input without damaging the PIC.

R2 and R4 tap 5v on the input down by about 1/4 to the pin - I don't see the point.
 

Offline paul23Topic starter

  • Regular Contributor
  • *
  • Posts: 91
  • Country: es
Re: What do these Resistors do?
« Reply #9 on: January 18, 2012, 07:17:57 pm »
Thanks for your help.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf