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

Hmm..

Regarding alteration of Wayne's boards..

It looks as though the LED is feeding into the DB9-pin3 as per the original schematic, and needs to be feeding into DB9-pin2 as Pablo pointed out.

If I am reading Wayne's images correctly, the DB9-pin2 lead is not connected to the ground plane around it. Additionally, DB9-pin3 is not connected to any other parts of the circuit. This means that modification of the board should be pretty simple. Swapping pins 2 and 3 means that the LED would be connected to pin-2 while pin-3 would be left hanging.

The simplest modification would be to solder the DB9 connector to the board as though nothing was wrong. Then use more solder to bridge pins 2 and 3 on the board. Finally, clip the lead to pin-3 above the solder joint so it no longer connects to the DB9 connector.

This would reroute the LED's connection to DB9-pin2 and leave DB9-pin3 hanging, as per the revised schematic.

Anyone see any blatant errors in that logic?

-------------------------

While I was looking closer at the DB9 pinouts, it seems to me that DB9-pin5 on Wayne's board is also isolated and hanging in space. According to the schematic (and the RS232 standard), DB9-pin5 should be grounded.

Wayne. Can you verify whether or not DB9-pin5 is free-hanging or grounded? The images you posted don't have a high enough resolution for me to be certain.

If it isn't connected to ground, this is an even simpler fix. The ground-plane runs all around DB9-pin5. Scraping off some of the solder mask on the ground-plane near the pin and soldering from the DB9-pin5 location to this would fix the problem.

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

Closed unit:

datalog1.jpg

datalog2.jpg


Used an old Carver audio box, and covered the OPT101 with a piece of cd acrilic case hotmelted inside /ubbthreads/images/graemlins/smile.gif

EDIT:
TIP: I grounded the switch chassis, so when an aligator is not being used, I clamp it to the switch handle and the measurement is zero.

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

[ QUOTE ]
PEU said:
After 17hs of logging the logger only drifted -0.63%

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

[/ QUOTE ]

Pablo,

Though 0.63% is below 1% spec, it seems too much to me -- over 6 minutes less records for 17+ hours logging.

Try to follow my previous post in this thread about the calibration and you will get far better accuracy.

I get this much from my logging.

time = 2005-02-07,22:27:35 (9869 seconds elapsed)
record = 9870 (0 of 9869 seconds 0.00% drifted)

time = 2005-02-05,23:40:47 (41081 seconds elapsed)
record = 41081 (-1 of 41081 seconds -0.00% drifted)

time = 2005-01-24,15:55:59 (11544 seconds elapsed)
record = 11544 (-1 of 11544 seconds -0.01% drifted)

I have no complaints about it now.

In your case, it works out this way.

398 / 63180 * 1000000 usec / 8 / 8 = 98.429 rounded to 98

#rom 0x2100 = { 98 } // compensate (make it faster)
#rom 0x2101 = { 0 } // compensate (make it slower)


With this change, the clock accuracy should be far better than what you have now. You may want to try 99 also.

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

[/ QUOTE ]

A quick start guide.

-p i com port (1)
-b l baud rate (9600)
change com port and baud rate baud rate

-r raw output mode (vs processed output)
raw output will have only the ADC counts, no voltage or other calculated value display/log

-c count mode in log file
Have integet counter display/log instead of timestamp

-t i count between logging in file (1)
Log every i records, useful for Excel charting of max 32000 records

-v d reference voltage (5.0)
some 78L05 output is not exactly 5.0V, but 5.01V mine and 4.9xV yours.

-a i adc max count (4096)
For other ADC resolution, future use.
There is a minor logic flaw in my PC program, will correct later.

-l i light adc max count (0)
-s d current sense resistor (0.16)
-S d current sense resistor (ch2 only)
Used to calculate the current and relative brightness, I don't rely on the calculated values. I ignore the calculated % and recalc on spreadsheet.

I hope it is simple enough.

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

Yes, Pin 5 is not connected. This will need to be corrected as you have explained.

So, far no show stoppers on the board. A couple of minor fixes.

Let me know if it is unusable.

Box should go out tomorrow priority mail. Can't wait to see one up and running.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

Is anyone going to sell the board and parts especially the programmed PIC? If so how much?

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

After the correction:

# time = 2005-02-17,11:43:33
# log file = zzz.txt (1 sec interval)
# voltage reference = 4.960
# 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:01,0000,0000,0000,3206,0.000,0.000,0.000,3.886,0.000,3206.0
.
.
.
0.15:59:01,0000,0000,0000,2206,0.000,0.000,0.000,2.674,0.000,2206.0
time = 2005-02-18,11:56:56 (57516 seconds elapsed)
record = 57540 (23 of 57516 seconds 0.04% drifted)
logged = 57540 records at 1 seconds interval

0.04% Drift /ubbthreads/images/graemlins/wow.gif


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

[ QUOTE ]
PEU said:
After the correction:

0.15:59:01,0000,0000,0000,2206,0.000,0.000,0.000,2.674,0.000,2206.0
time = 2005-02-18,11:56:56 (57516 seconds elapsed)
record = 57540 (23 of 57516 seconds 0.04% drifted)

0.04% Drift /ubbthreads/images/graemlins/wow.gif


Pablo

[/ QUOTE ]

Not bad. Now it is going (a little) too fast. You may want to try smaller number to le tit go slower.

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

Got the pcb's from Wayne Late Saturday Afternoon, Very Nice Wayne Thank you very much, /ubbthreads/images/graemlins/thumbsup.gif

So, got busy building the cpf-logger and noticed the DB9 part iis not the right part.

cpf-logger-1.jpg

cpf-logger-3.jpg


I think we need something shorter I will try and see if I can get it exchanged for the right one from digikey. If anyone konws of the right part please feel free to inform me.

Also, I could not get it to work the first time, got a solid led /ubbthreads/images/graemlins/frown.gif

I tried to short pins 2 and 3 from the db9 with a jumper wire and still no blinking light, Will try to trouble shoot again as time permits.

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

Hi Roberto,

Hm.. That pretty much blows about the connector.

Doing some more digging, I finally figured out what Wayne's part number means for this connector. It's a 0.318" footprint connector. So I guess I screwed the pooch on this one as I specified a 0.590" footprint.

Even worse news is that the price on the correct connector is even lower. Though I guess that could be good news if Digikey lets you exchange them.

The part number I found is: 182-809F-ND
Cost: $1.91ea

--------

For your testing. Don't forget that you may need to disconnect pin3 to make this work. You can do this by cutting off pin3 at the connector or on your cable.

Also, you will need to jumper pin5 to ground if you haven't already.

Sorry for the screw-up on my part..

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

Bummer on the connector. But, The 9 pins is probably more than ample to hold the whole assembly together. If you can use them as is, that should be OK.

Thanks for the pictures. I see you loaded the sip connector for the opto sensor on the top side. The bottomside has the other opto.

Unfortunately, the footprint is a topside only version and you have inverted the dip version of the opto by loading it on the backside.

The way the layout is, you can load one or the other unless you want to put the sip connector on the bottomside.

Hope hooking up pin 5 for GND and getting the pin 2,3 gets the board working.

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

Thanks PB, will get with DigiKey and see if it can be swapped if not no worries I'll get them anyway.

This gives me a good excuse to review DJ's notes for calibrating the PIC I think I'm missing something,

Here's what I will be doing DJ, PEU and PB please advise

step 1) Blank the PIC12F675. Using both the erase chip and
erase check functions of the DIY K150 software.

step 2) Read the value of the PIC's RC oscillator factory
callibration stored in program flash location
0x03ff.

So, I go to Options->Edit Hex Code.
At the bottom of the 1st column in memory location
03FF I see the value of 3FFF copy this value
Am I correct that this value is the uPICs unique
factory calibration value or did I just wiped it out
because I erased the PIC?

step 3) insert the value 0F34 in program flash memory 0x03FE
Ok, here's where I got /ubbthreads/images/graemlins/confused.gif confused

DJ said:
------------------------------------------------------
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.
------------------------------------------------------

Does this mean plug in 0F34 (0x34) where x is F? tha's the value I read in memory location 03FE.

Please explain further DJ.


Wayne said:
-----------------------------------------------------
Unfortunately, the footprint is a topside only version and you have inverted the dip version of the opto by loading it on the backside.
-------------------------------------------------------

Thanks for pointing this out Wayne, I remember you mentioned this in the thread but CPF forums where down for maintenance
Sunday and could not get the info I needed so I guessed wrong /ubbthreads/images/graemlins/frown.gif No worries, I'm handy with a solder sucker will fix tonight /ubbthreads/images/graemlins/grin.gif

If there are no objections Id rather ship the right db9 part that way the connector gets grounded properly and fits nicely on the board, not sticking out like this.

We are close! real close keep up the faith!!
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

/ubbthreads/images/graemlins/popcorn.gif
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

@DJ,


Let me know if this procedure is acceptable:

First I blank and erase the PIC.

Load the cpf-logger-lite-pic hex code using the DIY K150 v140904 software.

Press CALIB button on the DIY, Now it prompted this

The OSCAL value should be in the form of RETLW instruction [34xx]]

Currently [3Fxx]

Do you want this changed?

I hit Yes, now this automatically changed the location 0x03FF to 34FF and location 0x03FE to 3FFF

Am I correct to assume the software I'm using warns me that these values need to be changed and prompts me to do so, In effect I'm doing what needs to be done but in a different way?
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

noooo!!, dont erase the pic first.

If you erase it without protecting the OSCCAL bytes you lost them forever.

If you use winpic ( www.qsl.net/dl4yhf ) to program the pics it takes care to not overwrite them, unless you explicitly tell it to overwrite.

the OSCCAL bytes are located in the last 2 code positions, as DJ taught us.
In the pics I purchased (10x 12f675) the oscal value was between $3420 and $3430

The byte at location $03fe is always $34, the byte that is really important is located at position $03ff (dj explained as: NN = OSCAL, the original value you read from the PIC)

the calibration process comes after you have the logger working (led flashing) and sending data to the PC.

I left the logger for an entire night and that was the value I gave to DJ and he posted the calculation method for the correction value.

This correction value is expressed as decimal, but you need to convert it to hex before putting it in the first 2 bytes of the data section. 1st byte is used if you need to accelerate the clock, the second byte is the opossite.

After the correction the drift is only 0.04% and that is for a full weekend of logging (220000+samples)


EDIT: /ubbthreads/images/graemlins/frown.gif we were posting at the same time... hope you dont keep deleting pics /ubbthreads/images/graemlins/smile.gif


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

Roberto,

If you use K150 with MicroPro v141204 (diypack25), pressing CALIB button will ask you the same question to isnert and you answer YES. Then click READ button to read back the original OSCAL value.

If you already erased off, try 0x80 and provably you may get it working. he baud rate may run slightly, but 9600 baud is slow enough to accomodate.

But the problem you are facing is more likely due to the mixed com port pin 2 & 3 as Pablo experienced. The output of the PIC through the led is (closed to) either 0V or 5V and pin3 is negative from PC, so the led may be always on.

Switching the TX pin to 2 instead of 3 would solve it.

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

Ok,

Got the correct db9 ordered, digikey graciously gave me an RMA # for the wrong one. /ubbthreads/images/graemlins/thumbsup.gif

Could not wait for the proper db9 to arrive so I cannibalized a usb to serial converter that I busted a while back.

Got the blinky led to come up /ubbthreads/images/graemlins/grin.gif

blinky1.jpg


blinky2.jpg


swapped pin3 to pin2 and cut a trace on the pcb board leading to D3 pin3 on the serial db9

grounded pin5 to the negative of the 10 uF cap and used a laplink cable and got the blinky led.

Need to hook this up to my charger and see if I get any outputs.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

News from the AVR version

Finished the hardware and wrote my first c programm for
a the AVR. I used AVR GCC.

Had a lot of Problems reading the uart, until I changed
the LED for an MAX232 driver. Then it worked.
I tried the LED Version an my Laptop and my Desktop
neither worked.

Therefore I will do an redesign on the hardware and
post the results then, when the hard and software
are finished. ...

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

[ QUOTE ]
Ralf said:
News from the AVR version

Finished the hardware and wrote my first c programm for
a the AVR. I used AVR GCC.

Had a lot of Problems reading the uart, until I changed
the LED for an MAX232 driver. Then it worked.
I tried the LED Version an my Laptop and my Desktop
neither worked.

Therefore I will do an redesign on the hardware and
post the results then, when the hard and software
are finished. ...

Cheers
Ralf

[/ QUOTE ]

Ralf,

PIC12F675 doesn't have a UART and I am using software bitbang to emulate. By using software to control, I can let the PIC invert the output, so RS232 driver such as MAX232 is not needed.

If you are using hardware UART, you have to use a hardware driver to invert the signal. MAX232 is one and you can also use allas DS275 or DS1275. Or the simplest one is using a transistor only since we are using the output only.

Another advantage of using a software emulation is using one io pin for both RX and TX.

-- dj

PS.
The serial port access on Win32 using cygwin system really sucks. On some machine, it may or it may not work and you may need to use a batch file to run mode command before the gcc program while the original UNIX/Linux machine have no problem.

Last a couple of days, I played VB to use MSCOMM ActiveX driver and it works just fine. I hate Windows programming, but I may have one exception for this.
 
Re: CPF-LOGGER-Lite: Simple DIY Data Logger for CP

dj,

I used the MAX232 and had since then no problems. I'd liked
to go ahead with the software and as I fiddeled a whole day
with the LED and tried even inline assembler to invert the
signal I just gone the hardware way 🙂

I am using an AVR mega8 because I had one laying around
and this one has got an hardware Uart ...

I am completly on linux and do now port your pic c program
to avr-gcc. I have already the uart and the adc working
and hope to post the AVR-cpfLoggerLite by the end of the
week ...

Cheers
Ralf
 
Back
Top