PCB Heaven

General Category => Digital discussion => Topic started by: Teza on April 29, 2012, 22:40:17 PM

Title: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on April 29, 2012, 22:40:17 PM
Thank you for the work you put into this website.
Tho I am not active in posting, I have spent a lot of hours reading.

I am very interested in this fan controller (http://www.pcbheaven.com/circuitpages/PWM_3_Wires_Fan_Controller_with_RPM_feedback/) and the pc health monitor (http://pcbheaven.com/projectpages/PC_System_Health_Monitor/?p=0) you have created, and I want to learn as much as possible about this.
I have therfore bought equipment and set up a home lab for this purpose.
My knowledge is low but hopefully I will understand more the next weeks.

First:
Have now tryed to connect the parts on the breadboard, following your schematic and reading the datasheet of the components.
The mosfet schematic from the datasheet, look a bit different from what you have in your schematic.

(http://www.terjeandersen.no/forum/PCBheaven/Mosfet.PNG)

VISHAY FORMERLY I.R. - IRF520PBF - MOSFET, N, 100V, 9.2A, TO-220
Hopefully I bought the correct Mosfet?

Second:
I need 2 different voltages in this circuit, 12 and 5 volts.
I have a feeling that using two different powersupply might cause problems as they will be connected together via ground in this circuit?

For this reason I have not dared to set power to the circuit yet. (click image for larger picture)

(http://www.terjeandersen.no/forum/PCBheaven/PWM3WFanController00s.png) (http://www.terjeandersen.no/forum/PCBheaven/PWM3WFanController00.png)
 
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: George on April 30, 2012, 01:01:31 AM
For a cheap but extremely useful home project power supply look at pike's project
http://www.pcbheaven.com/userpages/Bench_power_supply_from_pcs_power_supply/

Get an old power supply from a no longer used PC chassis, or get a new one from a PC supplier.

Hope this helps and good luck with your efforts.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on April 30, 2012, 09:32:26 AM
Hello Teza.

First of all, some words regarding the PC Health monitor. I began making this project without knowing what size i would end, so it really became huge.  The latest PCBs that i made were 3 x 80 by 65 stackable, one had the 2 PIC micros, one with 8 fan interface and one with temperature and other interfaces. I've never ended this project because i just cannot put an end.

Now, regarding the mosfet, this is indeed the correct one.As for the supplies, you will need 2 different supplies indeed, and you must connect the grounds together. The PC PSU (http://www.pcbheaven.com/userpages/Bench_power_supply_from_pcs_power_supply/) that George suggested is indeed a very good solution for bench power supply ( i use the same one myself for bench supply).
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on April 30, 2012, 17:52:03 PM
Thanks to both of you for fast reply.

I already have many powersupplies, was just a bit worried about connecting the - 12 and -5 volt together.

I have a faily good feeling of what I need for my project, it is quite close to yours.
Also have a good idea on how everything should be connected and work together.

But before I can continue I'll need to get the fan controller sorted out, and lucy for me, there is a lot to learn as well.

Do you have any pictures of your current setup?
(no need, just curious)

Edit:

First failure, burned the PIC on first try, it was to hot to be able to hold the finger on it.
What went wrong?

Followed the schematic again and found my 1st mistake straight away.
I am not using the same type of led in my circuit.

The spec on my led is:
Forward voltage: 3,2V min - 3,4V max
Forward current: 20 mA

(http://www.terjeandersen.no/forum/PCBheaven/LEDresistorCalculate.png)

I need to replace my resistor with one at 82 ohm.
By using a 150 ohm resistor the current should be around 33 mA so this should not kill the PIC.

After checking the datasheet of the PIC it also seems like the circuit is connected correctly.

(http://www.terjeandersen.no/forum/PCBheaven/PIC16F88pinlayout.png)

Checked the PSU and it delivered 6.5V when showing 5V (gives 5V when it shows 3,8V).

I guess this was enough to kill the PIC, or is there also something else that might be wrong?
Can I kill the PIC if I have failed to program it?
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on April 30, 2012, 22:30:21 PM
PIC and mosfet is replaced, and the fan spins.
By changing on the potmeter i get no visible change in the speed of the fan.
So guess I need to look on the signals to find out what is not as it should be.

Have bought an oscilloscope as well for this project, but the knowledge is poor regarding this instrument.

Is it correct to connect ground on the scope probe to -5V and the probe to the:
- tacho wire of the fan on channel 1 (to read feedback from the fan)(green in your video?)
- pin 9 of the PIC on channel 2 (to read the pwm pulses)(yellow in your video?)
How is the blue channel in your video connected?

Is it possible to damage the oscilloscope in some way on this circuit by connecting it wrongly some how?
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 01, 2012, 11:14:47 AM
why do you need -5V ???? You should use the +12, +5 and gnd. If you connect -5 to ground of the scope then you might get bad results through the grounding of your apartment. Usually, do not do this unless your power supply is isolated (PC PSUs are usually not isolated from mains)

If you connect the ground of the oscilloscope to the ground of the supply (0V), then you can connect the other channel to the positions you mentioned. As for the bluechannel, if i remember well, i had programmed an extra output in the PIC to go high during measurements and low during PWM runtime. I had done this to get synch signal for the oscilloscope, but i'm not sure if this feature exists in the assembly listing that you have. Try porta,2, i think that it still exists in the listing (the LED port).

If you do NOT have negative voltages in your circuit (-5,-12) then it is hard to damage your scope. But this also depends on the protection that your scope has. By the way, which one did you bought? Can you send photos?
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 01, 2012, 13:41:44 PM
It is me mixing different things.
Ground from both psu is connected together in my circuit (was thinking on these as -5V and -12V, but ofc they are 0V)

The fan runs for about a minute before it stops.
The voltage starts climbing slowly from 5 volt when turning the power on (even with the 12V disconnected).
Think I will find another PSU to see if this might be the reason, and replace the components in case some is broken.


The oscillosope is an Agilent Technologies DSOX2024A with activated wavegenerator and education kit.
The 8 digital channels is not yet activated.

More details here (http://www.home.agilent.com/agilent/product.jspx?nid=-33575.970753.00&cc=NO&lc=eng)

(http://terjeandersen.no/forum/PCBheaven/scopes.png) (http://terjeandersen.no/forum/PCBheaven/scope.png)
(click on image for larger verson)


Update:

Have modifyed the cables on the PSU that will be used in my project, and replaced both of the previous power supplies with this one.
Also found a red LED to replace the one I had as I do not have a 82 ohm resistor.

The circuit now behaves different than earlyer.
The red led is flashing and lights continuous if I stop the fan with my hand.

By adjusting the potmeter there is a visible change in the rpm of the fan.
By turning the pot all the way to the right, I have stable 5.2 volt on my voltneter.
By turning the pot all the way to the left the voltmeter runs up and down from 0,3 to over 2 volt.
Anywhere between minimum and maximum gives the same running in voltage.
(voltmeter is connected to pin 9 of the PIC).

Also tryed to connect the scope to the pin 9 of the PIC (first image) and the tacho wire of the fan (second image)
First image was unexpexted (don't know what this is) and the second at least showed pulses.

(http://www.terjeandersen.no/forum/PCBheaven/scope_1.png)
(http://www.terjeandersen.no/forum/PCBheaven/scope_2.png)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 01, 2012, 23:45:53 PM
Have tryed to connect the LCD to the circuit to read the rpm.
All pixels is lightening, but no text shows.

In the datasheet of my LCD there is added  a 4K7 resistor between pin 6 and ground and 10K resistor between ground and pin 11, 12, 13 and 14. Can this be the problem?

It is a 2 x 16 LCD, but thought it would still show the text as you have used the first two lines on your display?
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 02, 2012, 15:23:14 PM
First regarding the voltmeter, at pin 9 most probably you see the RMS value of the pulses (12x0.707). You should try to scale the time/div of the oscilloscope and measure again at pin 9. You should see pulses there from the PWM
The LED works correct as you describe. The LED pulses when the fan rotates, and remains turned on when the fan is stalled.

The only problem that i notice is the LCD. Pin 6 cannot be connected to ground, since it is the E pin. Are you sure that you use an LCD with the same controller?
Normally, a 2 by 16 LCD with the same controller should work with no change at all.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: George on May 02, 2012, 15:32:32 PM
Also check the pinouts on your LCD - I've seen some that are not pin1-16, ie one was 15,16,1-14.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 02, 2012, 18:16:50 PM
I am very grateful for your feedback.

This display belongs to a unused Parallax board I have, bought just before I found this site.
On the parallax board there is some very small resistors before the socket for this LCD. (can't read their value)

If this display is a bad choice I'll order a new one.
 
From the Parallax datasheet (http://www.terjeandersen.no/forum/PCBheaven/lcd2x16par.pdf):
Quote
The LCD uses the HD44780 series LCD driver from Hitachi, or
equivalent controller. The LCD is connected to a female 14-pin
connector for easy interface with the BS2p24/40 Demo Board
(#45187) and the Professional Development Board (#28138).
Though the device has the ribbon cable and 14-pin connector it may
also be hooked up manually using the diagram on the next page.

(http://terjeandersen.no/forum/PCBheaven/LCD.png)

From the Hitachi datasheet (http://www.terjeandersen.no/forum/PCBheaven/Hit44780.pdf):
Quote
Description
The HD44780U dot-matrix liquid crystal display controller and driver LSI displays alphanumerics,
Japanese kana characters, and symbols. It can be configured to drive a dot-matrix liquid crystal display
under the control of a 4- or 8-bit microprocessor. Since all the functions such as display RAM, character
generator, and liquid crystal driver, required for driving a dot-matrix liquid crystal display are internally
provided on one chip, a minimal system can be interfaced with this controller/driver.
A single HD44780U can display up to one 8-character line or two 8-character lines.
The HD44780U has pin function compatibility with the HD44780S which allows the user to easily
replace an LCD-II with an HD44780U. The HD44780U character generator ROM is extended to generate
208 5 ´ 8 dot character fonts and 32 5 ´ 10 dot character fonts for a total of 240 different character fonts.
The low power supply (2.7V to 5.5V) of the HD44780U is suitable for any portable battery-driven
product requiring low power dissipation.
Features
·  5 ´ 8 and 5 ´ 10 dot matrix possible
·  Low power operation support:
¾  2.7 to 5.5V
·  Wide range of liquid crystal display driver power
¾  3.0 to 11V
·  Liquid crystal drive waveform
¾  A (One line frequency AC waveform)
·  Correspond to high speed MPU bus interface
¾  2 MHz (when VCC = 5V)
·  4-bit or 8-bit MPU interface enabled
·  80 ´ 8-bit display RAM (80 characters max.)
·  9,920-bit character generator ROM for a total of 240 character fonts
¾  208 character fonts (5 ´ 8 dot)
¾  32 character fonts (5 ´ 10 dot)



HD44780U
168
·  64 ´ 8-bit character generator RAM
¾  8 character fonts (5 ´ 8 dot)
¾  4 character fonts (5 ´ 10 dot)
·  16-common ´ 40-segment liquid crystal display driver
·  Programmable duty cycles
¾  1/8 for one line of 5 ´ 8 dots with cursor
¾  1/11 for one line of 5 ´ 10 dots with cursor
¾  1/16 for two lines of 5 ´ 8 dots with cursor
·  Wide range of instruction functions:
¾  Display clear, cursor home, display on/off, cursor on/off, display character blink, cursor shift,
display shift
·  Pin function compatibility with HD44780S
·  Automatic reset circuit that initializes the controller/driver after power on
·  Internal oscillator with external resistors
·  Low power consumption
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 02, 2012, 18:31:28 PM
When it comes to the pin 9 of the PIC, I can see the changes on the scope while adjusting the potmeter.

Lovely instrument!

(http://www.terjeandersen.no/forum/PCBheaven/setup_5.png)

(http://www.terjeandersen.no/forum/PCBheaven/setup_6.png)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 02, 2012, 19:37:08 PM
so, everything works except the LCD. The controller for the lcd is the same as the one that i use. Give it a shot without the pulldown resistors 4,5,6 and 11 through 14
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 03, 2012, 00:22:12 AM
Ah, I choosed my words poorly.
The LCD is currently connected without these resistors and looks like this:

(http://www.terjeandersen.no/forum/PCBheaven/LCD0.png)

I was thinking that these resistors might was needed for the display to work propertly.
If so I will buy some to test it. (adjusting the contrast of the LCD don't help)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 03, 2012, 10:09:25 AM
as i see, the lcd turns on. If it just is powered, you should only see blanks or only one row of black boxes. But i see two black rows, which means that probably you need to set your contrast lower.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: George on May 03, 2012, 12:29:16 PM
I agree with kam, try putting a 10k pot between +5V and ground with the contrast pin on the wiper (centre pin of the pot) & adjust it until you can see your display characters
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 04, 2012, 01:23:12 AM
Already done this :)
Noticed that with a 10K pot only the first line with boxes showed for a moment before both lines with boxes showed.
I can adjust the contrast so low that the boxes won't show, but no letters is visible.
Have bought some resistors today and will try to include them in the circuit, just to have tryed this.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 04, 2012, 22:12:49 PM
Weekend again  :)

(http://www.terjeandersen.no/forum/PCBheaven/LCD1.png)

1 small step furter, it now updates but I am not quite ready to learn chineese yet.
Resistors connected and the circuit is changed so there also is +5V to pin 3 of R5, pin 3 of the LCD goes to pin 2 of R5 and pin 1 of R5 goes to ground. (as in the datasheet of parallax).
Got a feeling it might still be some bad connections with the LCD tho...
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 04, 2012, 22:41:39 PM
Are these real letter  :o :o :o :o :o :o :o ????????????
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 04, 2012, 23:41:15 PM
Let's put it another way, what do I look for when choosing a correct LCD for this circuit?  ;)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 05, 2012, 00:04:24 AM
Let's put it another way, what do I look for when choosing a correct LCD for this circuit?  ;)

1st: The controller - should 99% be hd44780 or compartible if you look for character LCD
2nd: The characters (unless you can read those ideograms)
3rd: Connectivity. There are several LCDs with this controller but with attached serial or other connection board. I never use them, i prefer ye old 4-bits data transmission
4th: Backlit

That's just about it.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 05, 2012, 14:11:36 PM
In that case I had a bit luck when I bought the MC44005A main display (http://www.terjeandersen.no/forum/PCBheaven/40digX4LCD1485439.pdf) from Midas (http://www.midasdisplays.com/products/40-character-6.page) for the circuit.

I was thinking on the programming of the display (I currently use) in the PIC.
I read the program code (not understanding much at the moment) and wonder if the character code fitted the following list from the datasheet of the display that I currently use?

(http://www.terjeandersen.no/forum/PCBheaven/LCDchar.png)

Code: [Select]
Start
bank1 ;Go to bank 1
movlw b'00111011' ;
movwf TRISA ;Set the port pin types of the RA
movlw b'11000001' ;
movwf TRISB ;Set the port pin types of the RB
bank0 ;Go to bank 0
movlw b'00000100'
movwf t2con
bank1
movlw b'01100000'
movwf pr2
bank0

movlw GLSpeedDC_Startup
movwf ccpr1l
movlw b'00001101'
movwf ccp1con
;Setup TIMER 0
bank1
bsf OPTION_REG,T0CS
bcf OPTION_REG,T0SE
bsf OPTION_REG,PSA
bcf OPTION_REG,PS2
bcf OPTION_REG,PS1
bcf OPTION_REG,PS0
bank0
bcf T1CON,TMR1ON
bcf T1CON,T1OSCEN
bcf T1CON,NOT_T1SYNC
bcf T1CON,TMR1CS
bsf T1CON,T1CKPS1
bcf T1CON,T1CKPS0

;Setup Interrups
clrf INTCON
call wait250msec
call wait250msec
call LCD_Initialize
call wait250msec
call LCD_DisplayTurnOn
call LCD_CursorTurnOff
call LCD_Clear
;Entry mode set
movlw b'00000000'
call LCD_SendByte
movlw b'01100000'
call LCD_SendByte
call wait10msec
call wait250msec
call wait250msec
movlw b'00000000'
CALL LCD_SetCursorPosition
movlw 'P';
call LCD_ShowCharacter
movlw 'W';
call LCD_ShowCharacter
movlw 'M';
call LCD_ShowCharacter
movlw ' ';
call LCD_ShowCharacter
movlw ' ';
call LCD_ShowCharacter
movlw 'F';
call LCD_ShowCharacter
movlw 'A';
call LCD_ShowCharacter
movlw 'N';
call LCD_ShowCharacter
movlw b'01000101'
CALL LCD_SetCursorPosition
movlw 'r';
call LCD_ShowCharacter
movlw 'p';
call LCD_ShowCharacter
movlw 'm';
call LCD_ShowCharacter
movlw d'40'
movwf ccpr1l
bank1
bsf ansel,1
clrf adcon1
bsf adcon1,ADCS2
bank0
movlw b'10001001'
movwf adcon0
Mainloop
call wait250msec
bsf adcon0,GO_DONE
btfsc adcon0,GO_DONE
goto $-1
movf adresh,w
movwf ccpr1l
call wait250msec
bsf adcon0,GO_DONE
btfsc adcon0,GO_DONE
goto $-1
movf adresh,w
movwf ccpr1l
movlw b'01000000'
CALL LCD_SetCursorPosition
bsf ledpin
call GetRPMCount
bcf ledpin
movf PassArg6,w
addlw 0x30
call LCD_ShowCharacter
movf PassArg5,w
addlw 0x30
call LCD_ShowCharacter
movf PassArg4,w
addlw 0x30
call LCD_ShowCharacter
movf PassArg3,w
addlw 0x30
call LCD_ShowCharacter
goto MainLoop
GetRPMCount
bcf T1CON,TMR1ON
clrf TMR1H
clrf TMR1L
movf ccpr1l,w
movwf PassArg13
movlw GLSpeedDC_100
movwf ccpr1l
nop
nop
nop
btfss RPMInputPin
goto $-1
btfsc RPMInputPin
goto $-1
bsf T1CON,TMR1ON
btfss RPMInputPin
goto $-1
btfsc RPMInputPin
goto $-1
bcf T1CON,TMR1ON
movf PassArg13,w
movwf ccpr1l
movlw b'11100100'
movwf passarg1
movlw b'11100001'
movwf passarg2
movlw b'11000000'
movwf passarg3
clrf passarg4
movf TMR1h,W
movwf passarg5
movf TMR1l,W
movwf passarg6
call Divide24By24
movf passarg3,w
movwf passarg1
call b16_d5
return
LCD_SetCursorPosition
movwf passarg1
andlw b'00011111'
movwf passarg2
movlw b'11000000'
andwf passarg1,f
bcf carry
rlf passarg1,f
rlf passarg1,f
rlf passarg1,f
movlw 0x00
movf passarg1,f
btfsc zero
goto LCD_SetCursorPosition_Next
movlw 0x40
decf passarg1,f
btfsc zero
goto LCD_SetCursorPosition_Next
movlw 0x94
decf passarg1,f
btfsc zero
goto LCD_SetCursorPosition_Next
movlw 0xd4
LCD_SetCursorPosition_Next
addwf passarg2,f
bsf passarg2,7
movlw b'11110000'
andwf passarg2,w
call LCD_SendByte
swapf passarg2,f
movlw b'11110000'
andwf passarg2,w
call LCD_SendByte
call wait10msec
RETURN
LCD_ShowCharacter
movwf PassArg1
bsf LCDRS
call LCD_SendByte
swapf PassArg1,w
call LCD_SendByte
bcf LCDRS
return

LCD_Initialize
movlw b'00110000'
call LCD_SendByte
movlw b'00110000'
call LCD_SendByte
movlw b'00110000'
call LCD_SendByte
movlw b'00100000'
call LCD_SendByte
call wait10msec
movlw b'00100000'
call LCD_SendByte
movlw b'11100000'
call LCD_SendByte
return

LCD_Clear
movlw b'00000000'
call LCD_SendByte
movlw b'00010000'
call LCD_SendByte
return

LCD_DisplayTurnOff
movlw b'00000000'
call LCD_SendByte
movlw b'10100000'
call LCD_SendByte
return

LCD_DisplayTurnOn
movlw b'00000000'
call LCD_SendByte
movlw b'11100000'
call LCD_SendByte
return

LCD_CursorTurnOn
movlw b'00000000'
call LCD_SendByte
movlw b'11100000'
call LCD_SendByte
return
LCD_CursorTurnOff
movlw b'00000000'
call LCD_SendByte
movlw b'11000000'
call LCD_SendByte
return
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 05, 2012, 19:12:17 PM
If you use my code unchanged, then i never used such characters. Moreover, this character is nowhere to be found in this charset. Ar you sure you have the correct lcd version/
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 05, 2012, 21:43:27 PM
Was thinking on the binary numbers in your code as the upper 4 bits and lower 4 bits in the table over.
Then thought that maby different LCD's may supported different character sets, and that the same character code on two different LCD's might displayed different character.

Like if you swapped the characters in the table over from:
00110000 = 0
10110000 = -
to:
00110000 = -
10110000 = 0

But as you mentioned the character on the display is not even in the table over.
Was just trying to figure out why the characters was wrong and therefore thought on different character tables for different displays when reading the datasheet...

Edit:
Have ordered new LCD.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 19, 2012, 21:05:42 PM
Finaly got the new equipment and a new LCD is connected as follow:

(http://www.terjeandersen.no/forum/PCBheaven/pin.png)

When turning the circuit on, the bottom line shows a full line of black boxes for a short time.
Then both lines shows a full line of black boxes.
It seems like the LCD is getting signal updates as there is a kind of flashing regulary.

Adjusting contrast is not helping, just showing black boxes or nothing.

LCD datasheet 1 (http://www.terjeandersen.no/forum/PCBheaven/1485442.pdf)
LCD datasheet 2 (http://www.terjeandersen.no/forum/PCBheaven/MC20805B.pdf)

I just do not get this, am I connecting wrongly somehow?
I count the pins of the PIC as showed in reply#3 (http://www.pcbheaven.com/forum/index.php/topic,1565.msg5915.html#msg5915) in this thread.
The source code is not changed.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 20, 2012, 10:27:04 AM
What you describe seems to me as a wrong contrast. The one black line during startup are good news, and also the fact that this line then disappears (or becomes 2 lines) are also good news, which shows that the LCD is not broken and it initializes from the controller. But the contrast works also for you (you have a pot from grond to 5V and you supply the contrast pin with the middle take of the pot, right?).
I'm afraid that i run out of ideas  :-\
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 20, 2012, 14:59:53 PM
Actually no, but have tested it now.

Pin 1 pot - Ground
Pin 2 pot - LCD pin 3
Pin 3 pot - +5 V

Black boxes on 2nd line, disappear after short time and then boxes on both lines. Turn pot to left for higher contrast.

Pin 1 pot - +5 V
Pin 2 pot - LCD pin 3
Pin 3 pot - Ground

Same as the first as expexted, only turn the pot to the right

Pin 1 pot - Ground
Pin 2 pot - Ground
Pin 3 pot - LCD pin 3

This is how I read your circuit but I might be wrong.
Black boxes on 2nd line, disappear after short time and then boxes on both lines. Turn pot to left for higher contrast.

Using a 10K pot, tryed with a 2K pot with no differense, do not have a 20K pot for testing.
From the potmeter datasheet:
(http://www.terjeandersen.no/forum/PCBheaven/potcir.png)

Edit:

When looking on the picture of your working circuit it looks like the LCD is connected to pin 15 and maby 16 of your PIC, is this correct?
(yellow and brown wire, instead of 12 and 13 as in the drawing.)
Migth be wrong but it looks like it when I zoom in on the picture...

Have tried to move the wire from pin 12 and 13 to pin 15 and 16 of the PIC and changing letters appear on the LCD.
It is not correct viewed on the LCD, but at least it shows random letters.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 20, 2012, 18:09:54 PM
Now don't hate me, I am only trying to find out what is not working ;)
I have been following the wires on your testboard and compared it to the circuit drawing.

I have to say that there is some guessing as it is very hard to see what goes where on the board.

In this picture I have marked with red where I dont see a match:
(Click on image for larger verson)
(http://www.terjeandersen.no/forum/PCBheaven/Circuits.png) (http://www.terjeandersen.no/forum/PCBheaven/Circuit.png)

Is it me who are wrong or is there an error in the drawing?
I think there is a small difference but might be reading the schematic wrong.

Update:

Did not help much when trying to connect it differently tho...
Current circuit, connected as the schematic shows, unless I have done something wrong.

(http://www.terjeandersen.no/forum/PCBheaven/problems.jpg) (http://www.terjeandersen.no/forum/PCBheaven/problem.jpg)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 21, 2012, 18:36:46 PM
PIC pin 4 D and R are only for the ICSP connector, so just ignore them.

From the assembly listing:
#define RPMInputPin porta,4
#define PWMPin portb,3
#define LEDPin porta,2

;#define LCDRW portb,5
#define LCDRS portb,4
#define LCDE portb,5

#define LCD_P7 portb,2
#define LCD_P6 portb,1
#define LCD_P5 porta,7
#define LCD_P4 porta,6

So there are indeed errors. For some reason, i wrote "a" instead of "b" for LCD_P4 and LCD_P5. It should be:
#define LCD_P5 portb,7
#define LCD_P4 portb,6


Please do not hate me :D. I will upload the new version with this correction. If it works, please feedback.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 21, 2012, 21:38:28 PM
Can't hate you, you're too kind ;)

Must say that I felt like a kid on x-mas eve when programing and reconnected the PIC.
Then nothing worked...
But after the second try of programing the PIC, the circuit worked as before.

Sadly there is no change in behaviour of the LCD, but hey, one step closer.
Thanxs!

Maby what I need is to find a simple program just to test the LCD to eliminate there beeing problems with it? Your PIC toturial book have not evolved this far yet, but there must be something about it on the net. (have not started to learn coding yet myself, wanted to get this circuit working first :) )

Update:
Had to try with the parallax LCD as well just to see, but with the same resolt.
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 22, 2012, 00:01:10 AM
hmmmmm now you put me into thinking. I'll check if i have some f88s in stock and i will upload the software myself to see what's cooking.
As for the LCD, pike had once found one good tutorial which he might like to share this link with us.

Regarding the book, i made one mistake when i began this site: I began war with many countries... I must first finish (and this will eventually happen before summer) the transistor e-book that i write, and publish it as a pdf. Then i began the long period of video making for transistors. And then, oh yes, it is THEN when i will finish (and probably re-write the book as it happened with the transistors) the PIC tutorial. I have some big plans for this, which hopefully will come to life...
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: Teza on May 22, 2012, 00:26:44 AM
Oh dear, I have lured your focus from your project over to mine, can I blame my dog for bad influence? ;D

Tho a very good opertunity for me to start learning.
Looking forward to the link, if he feels like sharing it  :)
Title: Re: PWM 3-Wires Fan Controller with RPM feedback (Pulse Stretching Method)
Post by: kam on May 22, 2012, 09:01:26 AM
damn, urgent business trip came up for tomorrow till saturday night.  :-\ :-\ :-\ :-\ :-\ :-\ :-\ :-\