CPF-LOGGER-Lite: Simple DIY Data Logger for CPFers

Candle Power Flashlight Forum

Help Support CPF:

Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

PEU,

Just out of curiousity what's the diode you used for U3? My first version did
not work as well and I suspect it was the regular RS zener diode I'm using,

I'm getting NO output at all, the led shines brightly, and if I disconnect the
serial port's GND and press the reset switch it flashes.

Tried using the -r option for raw output still no luck.

I'm building another one (almost complete) but this time I'm using SMT
Zener Diode BZX84-C5V6 5.6v from my parts bin got this diode from
ebay search SMT Zener Diode Design Kit



.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Here's an update.

t640_cpf_logger.jpg
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

@PEU,

I used 1N914/4148-Type Diode from radio shack as well, RS Catalog number 276-1122 on the first attempt. I thought it said zener diode on the package but I threw it away and can't find it. /ubbthreads/images/graemlins/frown.gif

oh well, too late now for the BZX84-C5V6 5.6v, soldered it on the proto-board already. Guess I'll find out tonight if it works or not.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

[ QUOTE ]
PEU said:
I just finished assembling the board, but I cannot make it work /ubbthreads/images/graemlins/frown.gif

Led turns on, PIC was programmed and verified twice, I even found an error in the posted schematic that already corrected.

Im using winXP and this commandline:

cpf-logger-lite-pc zzz.txt

[/ QUOTE ]

Pablo,

I understand how you feel when something you made didn't work as expected. Let me try to figure out with you. There are quite a few possible reasons, so we go along the ladder.

You need to identify if the non-functioning part is the PIC of PC.

1) The led is connected from PIC output to PC serial port. If the PIC is working, you shall see 1 flashing of the led per second or 8 flashings per second depending on the toggle switch position. If the led is constantly on, something is not right with PIC part. If PIC is ok, skip to 7).

2) If the PIC is not working, first check the power supply to PIC by measuring the voltage between pin 1 (+) and pin 8 (-). It should be around 5V from 78L05. If ok, skip to 6).

Edit: pin 1 and pin 8 corrected

3) If there is no power to PIC (and no short circuit), check input side of 78L05. It should be between 5V and 12V).

4) If there is no power input to 78L05, check the voltage to the diode input (in case blown or reverse) from DTR and RTS.

5) If there is no voltag to the diode input, check the com port wiring or cable.

6) If PIC is getting correct power supply (and the circuit is correct), you need to check if you included OSCAL value to the PIC. This issue was mentioned in my previous post and I repeat again since it is very important.

PIC12F675 has internal RC oscillator factory calibration value stored in the program flash location 0x03ff and you are supposed to read this value before you program the PIC and write back while you are programming the PIC.

Also you need to insert the value 0x34 in to the program flash location 0x03fe to get this calibration to work correctly.

The default value from the hex file for these two consecutive bytes are 0x3f, 0xff and you need to change it to 0x34, 0xNN (NN = OSCAL, the original value you read from the PIC) before you program the PIC.

I've seen the OSCAL value ranging from 0x60 to 0xa0. If this value is not correct, the output baud rate is also out and the PC serial port can't recognize the input. When the value is too out, the PIC may not work at all.

Somehow if you have already erased this value and programmed the PIC without it, you may want to try out 0x80. If the PIC seems working and yet no serial input to PC, you may need to change this value a little to see if it helps.

Now check the PC side. I assume that the led is flashing as explained in 1).

7) Most recent PC serial port hardware can work well with the low voltage input which is not compliant to the RS-232 standard. So the TTL output from the PIC through the low Vf red LED will work fine.

If you suspect the voltage is too low, try to short the led and test again.

8) On Windows machine, there can be many drivers linked to the serial port and some programs don't seem to work correctly. I mentioned this issue in my previous post also. I am suffering from this now.

On such PC configuration, most programs produced using MS compilers or using MS driver seem to work fine, but those third party software like the CYGWIN I use may have problem.

We can confirm this by using a terminal emulation program on PC. Start your faviorite program such as hyper terminal (yuk! I use CRT) and set to the correct com port, 9600,N,8,1 parameter.

If you see the incoming data, skip to 11).

9) Some PC communication program insist on the hardware handshake and you will need to fool the system th believe it is ok. So you need to join RTS & CTS, DTR & DSR.

10) As explained in 6), the wrong OSCAL value in PIC may produce wrong baud rate. This can be measured with a scope. We can also try to confirm this by using a terminal emulation program on PC.

Change the baud rate to another setting and see if you get a garbage input. Rotate through the all baud rate you have and try again. If you get something, it may say the OSCAL is incorrect. In this case, go back to 6).

11) If the driver seems problem, try resetting the com port by using the mode command. To me, this always works.

mode com1 baud=300 data=8 parity=n

Then start cpf-logger program again. If this works, you can create a batch file like this.

@echo off
mode com1 baud=300 data=8 parity=n > nul
cpf-logger -d %1 %2 %3 %4 %5 %6 %7 %8 %9

I hope this can help. If it doesn't work still, we will see where else we can check.

-- dj
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

WOW, lots of tests to do, I did not touched the oscal so maybe there lays the problem.

Tomorrow I'll go thru the whole procedure again, and will try to use a terminal under DOS so no windows interferences.

big thanks


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Well, did some tests:

7805 has 7.5v at the input
pic is getting regulated 5v

regarding oscal, winpic takes care of not messing with it, so far 3 pics I tried had these values at position 03fe/ff:

342C, 3420 and 3430, I even messed with the 2C one and reprogrammed to 80 as you suggested (probably I ruined this pic /ubbthreads/images/graemlins/smile.gif )

well still no go, next tests in the pipeline are going to be made with a DOS terminal.

Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

tried with DOS terminals and I get nothing /ubbthreads/images/graemlins/frown.gif not even garbage input.

Maybe is time to recheck the whole circuit. I used .01uF ceramic capacitors instead of 0.1uF but I guess this is no problem, if this is the suspect, then I promise 100 x /ubbthreads/images/graemlins/banghead.gif


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Pablo,

From your post, I presume the led is blinking once per second or 8 times per second. If not, there is no point trying DOS or anything else.

Your OSCAL value is rather small compared to those I've seen -- 0x80 to 0xa4. Changing 0x80 to 0x90 can make baud rate out.

Could you confirm the result of each steps I mentioned in the post?

-- dj
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

1) The led is connected from PIC output to PC serial port. If the PIC is working, you shall see 1 flashing of the led per second or 8 flashings per second depending on the toggle switch position. If the led is constantly on, something is not right with PIC part. If PIC is ok, skip to 7).

led does not flash, its on all the time

2) If the PIC is not working, first check the power supply to PIC by measuring the voltage between pin 8 (+) and pin 1 (-). It should be around 5V from 78L05. If ok, skip to 6).

measured 4.97v between pic pins 1&8 when running your cpf logger program, otherwise is -0.5v

3) If there is no power to PIC (and no short circuit), check input side of 78L05. It should be between 5V and 12V).

measured 7.5v at the 7805 input

4) If there is no power input to 78L05, check the voltage to the diode input (in case blown or reverse) from DTR and RTS.

verified in point 3

5) If there is no voltag to the diode input, check the com port wiring or cable.

verified in point 3

6) If PIC is getting correct power supply (and the circuit is correct), you need to check if you included OSCAL value to the PIC. This issue was mentioned in my previous post and I repeat again since it is very important.

PIC12F675 has internal RC oscillator factory calibration value stored in the program flash location 0x03ff and you are supposed to read this value before you program the PIC and write back while you are programming the PIC.

Also you need to insert the value 0x34 in to the program flash location 0x03fe to get this calibration to work correctly.

The default value from the hex file for these two consecutive bytes are 0x3f, 0xff and you need to change it to 0x34, 0xNN (NN = OSCAL, the original value you read from the PIC) before you program the PIC.

I've seen the OSCAL value ranging from 0x60 to 0xa0. If this value is not correct, the output baud rate is also out and the PC serial port can't recognize the input. When the value is too out, the PIC may not work at all.

Somehow if you have already erased this value and programmed the PIC without it, you may want to try out 0x80. If the PIC seems working and yet no serial input to PC, you may need to change this value a little to see if it helps.

Now check the PC side. I assume that the led is flashing as explained in 1).

checked as previous post, brand new pics, never programmed give these OSCAL values: 3420 / 3424 / 342C . Im using winpic to read/program/verify the PIC and this program takes special care of the OSCAL value, you need to specifically instruct it to overwrite oscal values, if not it reads and then restores the factory setting

7) Most recent PC serial port hardware can work well with the low voltage input which is not compliant to the RS-232 standard. So the TTL output from the PIC through the low Vf red LED will work fine.

If you suspect the voltage is too low, try to short the led and test again.

tried this, no results

8) On Windows machine, there can be many drivers linked to the serial port and some programs don't seem to work correctly. I mentioned this issue in my previous post also. I am suffering from this now.

On such PC configuration, most programs produced using MS compilers or using MS driver seem to work fine, but those third party software like the CYGWIN I use may have problem.

We can confirm this by using a terminal emulation program on PC. Start your faviorite program such as hyper terminal (yuk! I use CRT) and set to the correct com port, 9600,N,8,1 parameter.

If you see the incoming data, skip to 11).

9) Some PC communication program insist on the hardware handshake and you will need to fool the system th believe it is ok. So you need to join RTS & CTS, DTR & DSR.

10) As explained in 6), the wrong OSCAL value in PIC may produce wrong baud rate. This can be measured with a scope. We can also try to confirm this by using a terminal emulation program on PC.

Change the baud rate to another setting and see if you get a garbage input. Rotate through the all baud rate you have and try again. If you get something, it may say the OSCAL is incorrect. In this case, go back to 6).

11) If the driver seems problem, try resetting the com port by using the mode command. To me, this always works.


any ideas?


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

[ QUOTE ]
PEU said:
1) The led is connected from PIC output to PC serial port. If the PIC is working, you shall see 1 flashing of the led per second or 8 flashings per second depending on the toggle switch position. If the led is constantly on, something is not right with PIC part. If PIC is ok, skip to 7).

led does not flash, its on all the time

[/ QUOTE ]

The PIC is not working. If it is working, it should be flashing as it sends data to PC.

[ QUOTE ]
2) If the PIC is not working, first check the power supply to PIC by measuring the voltage between pin 8 (+) and pin 1 (-). It should be around 5V from 78L05. If ok, skip to 6).

measured 4.97v between pic pins 1&8 when running your cpf logger program, otherwise is -0.5v

[/ QUOTE ]

I made a wrong statement about the pin. Pin 1 (top-left) is Vdd (+) and pin 8 (top-right) is Vss (-). I will edit to correct my previous post.

I am sure you did correctly, but just in case, can you confirm if the pins are correct?

Also the serial output is on gp5 which is pin 2 of the PIC.

-- dj
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Yes, I measured PIC voltages using the ground from 7805 hole (Im using the to220 version) and yes, 4.97v was readed on pin1.

also pin2 is connected directly to the LED and then to the rs232 port (DB9 pin3)


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Doubting of my pcb design abilities /ubbthreads/images/graemlins/smile.gif I remade the circuit in a protoboard.

for testing purposes I put the led to gnd instead of the rs232 rx data, and powered it from an external 7805 based power supply.

well, the led blinks /ubbthreads/images/graemlins/smile.gif


then I redid the whole circuit taking power from the port, the led stays on all time /ubbthreads/images/graemlins/frown.gif


and then, BINGO /ubbthreads/images/graemlins/smile.gif your schematic is wrong: in a DB9 connector RX is pin 2 and not pin3 /ubbthreads/images/graemlins/wink2.gif

now I need to log, it seems the port hang up /ubbthreads/images/graemlins/smile.gif


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

# time = 2005-02-15,18:09:30
# log file = zzz.txt (1 sec interval)
# voltage reference = 5.000
# adc max counter = 4092
# light max counter = 4092
# current sense resistor = 0.160

Time,A1,A2,A3,A4,V1,V2,V3,V4,C,L
0.00:00:01,0194,0178,0192,0299,0.237,0.217,0.235,0.365,0.122,7.0
0.00:00:02,0252,0235,0250,0298,0.308,0.287,0.305,0.364,0.130,7.0
0.00:00:03,0279,0273,0279,0302,0.341,0.334,0.341,0.369,0.046,7.0
0.00:00:04,0322,0314,0322,0303,0.393,0.384,0.393,0.370,0.061,7.0
0.00:00:05,0359,0357,0366,0302,0.439,0.436,0.447,0.369,0.015,7.0
time = 2005-02-15,18:09:35 (5 seconds elapsed)
record = 5 (-1 of 5 seconds -20.00% drifted)
logged = 5 records at 1 seconds interval

1st-plot.jpg

(not the posted data)


/ubbthreads/images/graemlins/grin.gif



I just swaped pin 2&3 in the etched board connector and it worked.

THANKS DJ /ubbthreads/images/graemlins/happy14.gif

Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

That's true. I actually made a mistake in the serial port TX pin. It shall be connected to 2.

I am glad you made it working. Have lots of fun.

-- dj
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Time is not stamped when the logger is in 8 samples per sec, I dont know if this is a bug or a feature /ubbthreads/images/graemlins/smile.gif

EDIT: looked at the C code, is a feature.

again: THANKS DJ /ubbthreads/images/graemlins/happy14.gif


Pablo
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Where do I send the boards?

If I can get a destination address I'll try to plop the boards in the mail tomorrow. You can PM me or drop me an email.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Send them to me if there are no objections from fellow cpfer's, I ordered all the parts necessary from digikey and have the pre-programmed PIC12F2675

Do we need to modify the board in anyway to account for the schematic mishap i.e: move pin3 of the db9 to pin2?

I've tried this last night and did not get the blinking led so something else is wrong on my protobuild, will have to double check and go through the diagnostics DJ posted tonight /ubbthreads/images/graemlins/frown.gif I have NO doubt DJ's design is sound I've build a few of his designs before it's my soldering skills and electronic background that's the culprit here /ubbthreads/images/graemlins/hahaha.gif I blame it on my poor eyesight!

It would be nice to build one real quick using your board Wayne and post here for additional info for fellow cpfer's benefit,

As far as parts cost is concerend just pay me for the actual cost of the parts plus shipping that should cover it,

@DJ,

I'm sending you a complete kit just because /ubbthreads/images/graemlins/grin.gif

@Wayne,

email sent for my addy
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

After 17hs of logging the logger only drifted -0.63%

These are the first/last lines of the log:

# time = 2005-02-15,20:16:39
# log file = zzz.txt (1 sec interval)
# voltage reference = 5.000
# adc max counter = 4092
# light max counter = 100
# current sense resistor = 0.160

Time,A1,A2,A3,A4,V1,V2,V3,V4,C,L
0.00:00:02,0000,0000,0000,0005,0.000,0.000,0.000,0.006,0.000,5.0
.
.
.
0.17:26:24,1805,1031,0774,3511,2.206,1.260,0.946,4.290,5.911,3511.0
time = 2005-02-16,13:49:39 (63180 seconds elapsed)
record = 62783 (-398 of 63180 seconds -0.63% drifted)
logged = 62783 records at 1 seconds interval

command line was:

cpf-logger-lite-pc -l 100 zzz.txt

I quite don't understand all the commandline options /ubbthreads/images/graemlins/smile.gif


Pablo
 
Back
Top