Вы находитесь на странице: 1из 23

DATA L O G GER W I TH

H I GH S PEE D PC
I NTE RFAC E

ATHARVA INAMDAR
CANDIDATE NO# 0088
CENTRE NO# 52103
AYLESBURY GRAMMAR SCHOOL
2

TABLE OF CONTENTS

SUMMARY .................................................................................................................................................................... 3

BRIEF ............................................................................................................................................................................. 4

SPECIFICATION .......................................................................................................................................................... 4

BLOCK DIAGRAM....................................................................................................................................................... 4

EQUIPMENT ................................................................................................................................................................. 5

SYSTEMS ....................................................................................................................................................................... 6
ANALOGUE-TO-DIGITAL CONVERTER (ADC) ................................................................................................................. 6
Subsystem 1: Clock ................................................................................................................................................... 6
Subsystem 2: Counter ............................................................................................................................................... 8
Subsystem 3: Digital-to-Analogue converter (dac) ................................................................................................. 10
PARALLEL-TO-SERIAL CONVERTER ............................................................................................................................. 12
subsystem 4: Parallel-to-serial converter (piso)..................................................................................................... 12
DATA STORAGE AND TRANSMISSION........................................................................................................................... 14
subsystem 5: Sensor Data storage and transmission .............................................................................................. 14
DATA OUTPUT ............................................................................................................................................................ 16
subsystem 6: user interface ..................................................................................................................................... 16
END RESULT .............................................................................................................................................................. 18
CIRCUIT DIAGRAM ...................................................................................................................................................... 18
FULLY FUNCTIONAL BREADBOARD PHOTO: ................................................................................................................ 19
REVIEW AND EVALUATION .................................................................................................................................. 20

BIBLIOGRAPHY ........................................................................................................................................................ 21

ACKNOWLEDGEMENTS ......................................................................................................................................... 21

APPENDIX I................................................................................................................................................................. 22

APPENDIX 2: ............................................................................................................................................................... 23

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
3

S U M M A RY

I set out to design and build a data logging system for an analogue input. This system would consist of an
analogue to digital converter and a microprocessor to store data on an EEPROM and communicate with a PC. At
the end of this project, I have achieved all of the above. However, the data stored is raw data and is not calibrated.
It is intended that the user calibrated this data logger to their specific sensor. I have successfully met all the
specification points.

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
4

BR I E F

In schools sometimes it is necessary for pupils to record data at specific intervals for a long period of time such as, in a
Physics experiment recording the time. I will be developing a Data logger, which will be able to communicate with a PC
using a high-speed interface.

SPECIFICATION

Data Logger
o One Analogue input
 E.g. Thermistor
 8-bit resolution
o Store data for Analogue input
o Display data stored in PIC memory (buffer) or an EEPROM depending on user‟s need of data retention
 Data from PIC memory buffer will be transmitted in real-time to the PC
o Record data at a frequency of 1Hz
PC interface
o Serial interface with PC
o Transmit data stored in the EEPROM using Serial or USB connection
 To be used with applications such as HyperTerminal
 Communication uses 4800bits/s with no parity and 1 stop bit

BL O C K D I A G R A M

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
5

EQUIPMENT

Multimeter
PC with RS232 port
Set of coloured wires
o Red: positive power supply
o Green: 8 bit data connection
o Yellow: Interconnect subsystems
o Blue: Serial Comms with PC
o Brown: Clock
o Orange: general connections

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
6

SY STEMS

ANALOGUE-TO-DIGITAL CONVERTER (ADC)

SUBSYSTEM 1: CLOCK

Specifications: To produce a stable and clean square waveform of 4kHz.

Alternative-1: Crystal Oscillator


Alternative-2: Relaxation Oscillator (selected)

Advantages Disadvantages

Crystal Oscillator Accurate, clean and stable Difficult to buy a 4kHz crystal.
waveform

Relaxation Oscillator Accurate, clean and stable Reliability of operation depends


waveform on tolerance of resistors and
capacitors being used.
Cheap components such as
resistors and capacitors are Accurate waveform of certain
needed frequency is achieved by trial
and improvement method

A relaxation oscillator is sufficient for the needs of this data-logger. It is a cheap solution which has no major
disadvantages over a Crystal oscillator.

Circuit Diagram:

Component Values:
Capacitor: 1nF; Resistor: 35k

How Relaxation Oscillators work:


The output depends on the state of the input. However, the state of the input is determined by the state of the output due
to the use of a feedback resistor.
When the input of the Schmitt trigger is below +2.2V (lower trip point) then the output saturates to +5V. The current in
feedback resistor charges the capacitor raising the voltage at the input to above +2.8V. This will saturate the output to 0V.

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
7

Testing:
Testing was conducted using a frequency meter. The output was a stable frequency of 4kHz.

Photos:

40106B Hex
Schmitt
Trigger

Variable
1nF ceramic resistor
capacitor 35k

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
8

SUBSYSTEM 2: COUNTER

Specifications: Count up 255stages in binary outputting 8-bit parallel word

Alternative-1: 4029B configurable counter (selected)


Alternative-2: S-R Flip Flop

Advantages Disadvantages

4029B counter Dedicated counter IC Two separate ICs are needed

Configurable – 4-bit parallel


output

Can carry count to additional


counter ICs with synchronized
clock

Small footprint

S-R Flip Flop (setup as T-type) Are building blocks of a digital No advantage over using 4029B IC
binary counter
Footprint is extremely large for
consideration of practical or even
prototype application (Eight ICs
needed)

4029B is a dedicated counter IC and is the best solution for a data-logger. Using S-R flip-flops set up as T-Type
increases the footprint and performs the same function.

Circuit Diagram:

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
9

Component Values:
P1-P4, LD, EN are all connected to 0V. Clock for both counters is connected to the output of subsystem 1. U/D AND
B/D is connected to +5V to count UP. Carry from counter #1 is connected to Enable of counter #2.

How 4029B counter Works:


On power up the output is the same as inputs P1-P4 and C is high. On the rising edge of the clock, the output increases by
1 in binary. On the 15th rising edge Carry (on the 1st counter) is switched low. This enables the 2nd counter. On the 16th
pulse one is counted up on the 2nd counter and all bits on 1st counter are switched low. After 255 counts both counters are
reset and their outputs are low.

Testing:
Testing was done using 8 LEDs connected to the outputs. The clock pulses were provided by using a push-to-make switch
connected between the clock pin and +5V rail. The order of LEDs lighting up was checked. (see photo below showing
153rd stage 10011001).

Photos:

4029B
Binary up
counter

Green LEDs
for 1st
counter IC

Red LEDs
for 2nd
counter IC

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
10

SUBSYSTEM 3: DIGITAL-TO-ANALOGUE CONVERTER (DAC)

Specifications: Convert a 8-bit parallel word into and analogue output of corresponding value in real time

Alternative-1: Summing Amplifier (selected)


Alternative-2: PICAXE-28X

Advantages Disadvantages

Summing Amplifier Fast and real-time conversion of 8 resistor array is needed


digital input
Variable resistors need to be used
Max output voltage range is large to achieve accurate values
26V (-13V to +13V)
Large footprint
Output voltage range can be
controlled by altering the gain

PICAXE-28X Integrated DAC function Expensive solution for the


problem and the accuracy needed

Real-time conversion not available


as processing time is taken into
account with large binary numbers.

A summing Amplifier was chosen as it can provide a large voltage output range and can be controlled. The
output provided is an accurate representation of the Digital 8-bit word. PICAXE-28X is too expensive for such an
application.

Circuit Diagram:

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
11

Component Values:
Input Resistors: 1kΩ, 2kΩ, 4kΩ, 8kΩ, 16kΩ, 32kΩ, 64kΩ. 128kΩ
o These values are chosen to keep the current drawn minimal
Op-amp(summing amp): feedback resistor: 502 , input resistance = 1.5T , output resistance = 60
Inverting amplifier: gain = -1, input resistor = 1k , feedback resistor = 1 , input resistance = 1.5T , output
resistance = 60

How a Summing Amplifier works:


The summing amplifier adds the voltages of the inputs together considering the input resistances. The effect of the voltage
added depends on the weighting of the inputs. Thus the least significant bit has input resistance of 1k and the most
significant bit (8th bit) will have input resistance of 128k , thus when the 8th bit is high the voltage increase will be much
greater than the voltage increase by the 1st bit. As the counter counts up, the output of the summing amplifier increases in
steps of 0.05V ( 13V/256). The inverting amplifier is present to invert the voltage output of the summing amp to give a
true value instead of the inverted value.

Testing:
This was tested using a voltmeter on the output of the Summing amplifier. As the counter counted up the voltage was seen
to rise steadily

Problems:
Summing amplifier was saturating to 13V. the gain was decreased by using a 502 feedback resistor

Photos:
CA3140E

Feedback
resistors

Resistor array for Summing amplifier.


1k fixed resistor was used and all other values
were achieved with variable resistors

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
12

PARALLEL-TO-SERIAL CONVERTER

SUBSYSTEM 4: PARALLEL-TO-SERIAL CONVERTER (PISO)

Specifications: To convert a 8-bit parallel word to a serial stream including 1 start and 1 stop bit

Alternative-1: 4014B 8 stage Shift Register


Alternative-2: PICAXE-28A (selected)

Advantages Disadvantages

4014B 8 stage Shift Register Dedicated shift register for Start and stop bits are not included
conversion of a 8-bit parallel word in the serial data stream
to a serial stream
Very difficult to add a start/stop
Can output as 6/7/8 bits serially bit to the stream

PICAXE-28A 8 inputs which can be read Large footprint compared to


simultaneously 4014B

Serial data output stream adds start More expensive


and stop bits automatically.

Reliable operation with minimalist


program

PICAXE-28A was the only alternative, which can add a start and stop bit to a data stream while acting as an 8-
stage shift register. The dedicated 4014B shift Register was not able to add start and stop bits to the data stream.

Circuit Diagram:

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
13

Component Values:
8bit inputs are connected directly to the inputs of the PICAXE-28X
4k7 pull up resistor is used for the reset pin
Impedance (PIC):
o Input: 2M minimum at 4.5V VCC.
o Output: 233 when Output state = 1; 71 when output state = 0

How a PICAXE-28A is used as a PISO shift register:


A Binary number (8-bit) is stored in 1 variable (b0). Each bit of b0 stores 1 or 0 depending on the input state of each input
(07). This is then transmitted using the „sertxd‟ command using the „serout‟ pin. PIC program is shown in appendix 2.

Testing:
By programming a PICAXE-18X to display the value of the serial number on a LCD. The input to the PICAXE-28X was
manually held high or low and the output was compared with the input. This functioned as desired.

Photos:

4k7 pull- PICAXE-28A


up reset
resistor

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
14

DATA STORAGE AND TRANSMISSION

SUBSYSTEM 5: SENSOR DATA STORAGE AND TRANSMISSION

Specifications: To write a 8-bit word into EEPROM and read data to transmit to PC using a serial link of the
following format: 4800-8-n-1

Alternative-1: PICAXE with I2C EEPROM (selected)


Alternative-2: PICAXE with I2C RAM

Advantages Disadvantages

I2C EEPROM (24C64WP) Permanent data storage Slow read and write times

I2C RAM Fast read and write times Only temporary data storage

Data lost on power down

EEPROM was selected due to its ability of retaining the data on power down and thus is useful in the situation of
remote data collection.

Circuit Diagram:

Component Values:
4k7 pulled resistor for the reset pin on the PICAXE
Clock and data are synchronised through SLA and SDC pins on the PICAXE with same pins on the RAM.
o Pull-up resistors (10kΩ) on SDA & SCL
Connection from PICAXE-28A is direct without any need for discrete components.
EEPROM write control impedance > 500kΩ
o SDA & SCL i/p, o/p impedance = 4k7Ω (set by pull up resistors on line
Impedance (PIC):
o Input: 2M minimum at 4.5V VCC.
o Output: 233 when Output state = 1; 71 when output state = 0

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
15

How a PICAXE-18X is used to store data in I 2C EEPROM and transmit it to the PC:
A digital number transmitted by the shift register serially is read by the PICAXE. This is stored in the accumulator and
using the I2C protocol transferred to the RAM. The RAM stores this raw number (in binary) starting from its first memory
location (00h). Program attached in Appendix 1.

Testing:
A program was written in PIC BASIC and was simulated. The simulation was successful on a PC and was then tested using
PICAXE-18X on a breadboard. The display was first tested by severing the input and connections with the EEPROM. As
the photo below shows the display was functioning as desired.

Problems:
During the first testing stage with a PICAXE it was found that whenever a command to write to the LCD was sent the
previous display was not cleared, thus ghosting was occurring for unused matrices at the end of the string. This was
corrected by a simple clear screen command (serout 7,N2400,(254,1)). Initially, 100 F capacitor was used for decoupling; it
was found that the charge up and down times were too long so a 1nF capacitor was used.
Photos:

LCD Display
16x2
PCAXE-18X

Decoupling
Capacitor 1nF

Write Control
I2C
EEPROM
SDA/SCL 64Kbits

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
16

DATA OUTPUT

SUBSYSTEM 6: USER INTERFACE

Specifications: to display a menu and current task being carried out. If data is being recorded, the raw data value should
also be displayed.

Alternative-1: LCD screen (selected)


Alternative-2: LED matrix

Advantages Disadvantages

LCD screen Serial communications with Low resolution


PICAXE-18X
Each character space is made of a
Low power consumption crystal matrix

Only 2 rows available

Low visibility in high and (near)


zero luminous conditions

LED matrix Can customise to any matrix size Need a custom driver board
possible
Extremely low resolution
Range of colours for LEDs
Extremely high power
consumption

Extremely large footprint for any


application

LCD screen is the only practical alternative as it is dedicated display unit with built in driver circuit.

Component Values:
Impedance:
o Input: 2M minimum at 4.5V VCC.
o Output: 233 when Output state = 1; 71 when output state = 0

How a LCD screen is used as a user interface:


A serial byte transmitted by the PICAXE is received. This is interpreted by an Onboard driver IC which displays the
information. The protocol used is serial communications with baud rate of 2400bit/s, no parity, 8 bits and 1 stop bit.

Testing:
A simple program was written to display the message “Hello World!” and tested.
********
pause 10
main: serout 7,N2400, (254,128,”Hello World!”)
serout 7, N2400, (254,192, “Hello World!”)

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
17

goto main
********
This program functioned as desired and the LCD was displaying all the characters correctly.

Photos:
(see previous subsystem photo)

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
18

E N D R E S U LT

CIRCUIT DIAGRAM

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
19

FULLY FUNCTIONAL BREADBOARD PHOTO:

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
20

R E V I E W A N D E VA L UA T I O N

Data logger at the start displays first message after the delay of the one-second. This delay is may be due to initial charging
of the coupling capacitors, which are across the LCD power supply. “GO” switch is to initiate the analogue to digital
conversion. At the press of “Go” 8bit digital signal is converted into serial stream with start and stop bits. When "Record"
is toggled, the current data point and its value, which is being stored in EEPROM is displayed and the data is also sent to
PC at the same time. The display returns to menu again on toggling “Record”. Pressing "Send to PC", transmitted data
from EEPROM to the PC. During this function data is read from location 0 till the last point it was recorded. On the press
of ERASE EEPROM, data values at all location are be replaced by zero.

The following shows the results recorded by the PC:

Data received by PC during „Recording‟ and „Send to PC‟:

No# Data 29 206 15 206


0 0 30 0 16 204
1 0 31 206 17 204
2 204 32 0 18 0
3 204 33 204 19 206
4 204 34 0 20 0
5 206 35 204 21 0
6 0 36 0 22 204
7 204 37 206 23 0
8 204 38 0 24 0
9 204 39 204 25 206
10 206 40 206 26 206
11 206 27 202
12 204 Recieving Data... 28 0
13 204 No# Data 29 206
14 204 0 0 30 0
15 206 1 0 31 206
16 204 2 204 32 0
17 204 3 204 33 204
18 0 4 204 34 0
19 206 5 206 35 204
20 0 6 0 36 0
21 0 7 204 37 206
22 204 8 204 38 0
23 0 9 204 39 204
24 0 10 206 40 206
25 206 11 206 Data Received
26 206 12 204 Successfully
27 202 13 204
28 0 14 204

Photos:
The following shows photos of me operating the Data logger:
Recording Data: Erase EEPROM: Data sent to PC:

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
21

BIBLIOGRAPHY

CMOS Cookbook – Don Lancaster

Microchip.com – technical support

Electronics Explained – M. W. Brimicombe

ACKNOWLEDGEMENTS

Mr. M Harvey
PICAXE.com forum members

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
22

APPENDIX I

'Start low 0
'pin2 = input gosub clr_scn
'pin0 = record serout 7, N2400, (254,128, " MEMORY FULL!
'pin1 = erase mem ")
'pin7 = serial send data to PC serout 7, N2400, (254,192, " :( ")
'pin6 = read from mem button wait 5
'output 0 = record for tristate (write-protect) gosub clr_scn
'serout for LCD and PC goto main
'b2 = erase ram flag „read from mem
'b3 = data to send to PC mem_pc:
pause 50 gosub clr_scn
init: let b0 =0 serout 7, N2400, (254,128, "Send data to PC?")
high 0 serout 7, N2400, (254,192, " ")
serout 7, N2400, (254,1) if pin7 = 1 then
main: sertxd (13,10,"Recieving Data...",13,10, "No#
serout 7, N2400, (254,128,"Record Data? ") Data",13,10)
serout 7, N2400, (254,192,"Send to PC? ") serout 7, N2400, (254,128, "Sending Data")
if pin0 = 1 then record serout 7, N2400, (254,192, "Do NOT
if pin7 = 1 then mem_PC Disconnect")
if pin1 = 1 then erase_mem for b0 = 0 to 184 step 1
goto main i2cslave %10100001, i2cfast8, i2cword
clr_scn: readi2c b0,(b3)
serout 7, N2400, (254,1) sertxd (#b0, " ", #b3,13,10)
return next b0
record: sertxd ("Data Recieved Successfully")
if b0 = 185 then elseif pin7=0 then
let b0 = 0 goto mem_pc
endif endif
gosub clr_scn gosub clr_scn
low 0 serout 7, N2400, (254,128, "Data sent!")
sertxd ("No# Data", 13,10) serout 7, N2400, (254,192, " ")
for b0 = b0 to 185 step 1 wait 1
if pin0 = 1 then goto main
if b0 = 185 then mem_error
'let b1 = pin2 erase_mem:
i2cslave %10100001, i2cfast8, i2cword serout 7, N2400, (254,128,"Mem Full! DEL?")
serin 2,4800,b1 serout 7, N2400, (254,192,"Press Record")
serout 7, N2400, (254,128,#b0,"= ", #b1, " ") pause 2000
serout 7, N2400, (254,192,"Recording... ") gosub clr_scn
writei2c b0, (b1) if pin1 = 1 then
sertxd (#b0, " ", #b1,13,10) low 0
pause 990 b1 = 0
elseif pin0 = 0 then for b0 = 0 to 185 step 1
high 0 serout 7,N2400,(254,128,"Erasing MEM")
goto main serout 7, N2400, (254,192, "Do NOT Power Off")
endif writei2c b0, (0)
next b0 next b0
goto main let b0 = 0
mem_error: Endif
Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531
23

high 0 for b0 = 0 to 185


goto main i2cslave %10100001, i2cfast8, i2cword
'End let b1 = 0
serout 7, N2400, (254,128,#b0)
Program written to erase EEPROM serout 7, N2400, (254,192,"Erasing..... ")
'Start writei2c b0, (b1)
pause 10 next b0
init:serout 7, N2400, (254,1) 'End

APPENDIX 2:

'Start of program
pause 10
main:
'collect each bit in seperate variables
let b0 = pins & %1111111
'shift each bit through serout pin 4800-8-n-1 with start and stop bits
sertxd (b0)
wait 1
goto main 'loop
'End of program

Atharva Inamdar Candidate no# 0088 Centre no# 52103 Unit 2531

Вам также может понравиться