optical absolute position encoder project

Status
Not open for further replies.

stagnant7

New Member
Hi everyone,

I have a few questions relating to my project, but first of all a little background.

I am making an optical absolute position encoder. It is 8-bit (i.e. 8 IR LED emitters and 8 corresponding phototransistor recievers) and the disk is gray code. The aim is to measure average wind direction and output the info on a small LCD. So the shaft will be rotating at low speeds but with jittery directional changes. It also has to be of low power consumption, continuouly operating for a few days running, about 3 days. The source of the power for now is a quality 9V battery, as it has to be portable, but im open to any other suggestions.

The sensor circuit setup has tested fine so far (although i have not actually put all 8 in action with the code wheel yet). I originally assumed I would need a schmitt trigger to ensure a clean, reliable digital signal (to send to the microcontroller), however the image below shows that perhaps the 7414 hex schmitt IC is not required? In the image below, the blue waveform is without the 7414 hex inverter, and the yellow is the conditioned signal outputted from the 7414 hex schmitt IC.



Would I be best off keeping the 7414 IC in place? or would leaving it out offer me a saving in power consumption (for 8 sensors I would need two 7414 IC's)?

The next question is selection of the microcontroller. Perhaps 4 years ago I breifly used a PIC18F452 microcontroller in a group project, and so although im not totally inexperienced I am a little rusty in my microcontroller knowledge
I'm taking over this project from a previous student (a total rebuild with the aim of improvemnt, but certain ideas will be reused) and they used a MSP430 low power microcontroller from texas instruments. This is a 3.3V microcontroller, and to me it seems a pain to bother with voltage supply translation IC's (three 74LVX3245 were used in the previous project) in an other wise simple elegant piece of hardware. Would the benefits of a low power MCU be lost with all this mucking around with level translating IC's and the need to power them. Basically the signal will go from 5v for sensor circuit....then 3.3V for input to the MCU....then back to 5v for LCD panel!

I figure simple design with an appropriate 5V MCU will be fine to run for a few days yes/no?

What to people here think about this and suggest for an MCU?


In general in which areas of design should i be careful/aware of to avoid careless power consumption?

I have probably missed out some information required to answer these questions accurately and I am happy to give any extra info required. The LCD panel used in the old project was a MC1602C-SYR but I havent given this any thought in terms of improvement or upgrade.

Many thanks in advance for any knowledgeable help
 
any other suggestions.

Would I be best off keeping the 7414 IC in place? or would leaving it out offer me a saving in power consumption (for 8 sensors I would need two 7414 IC's)?
Many thanks in advance for any knowledgeable help

hi,
Looks an interesting project.

I would use HC or CD CMOS logic devices, for the much lower power drain than standard TTL.

The 40106 or 74HC14 or 74HCT14 are low power CMOS Schmitt gates.

Looking at the image it shows a time interval of 50mSec, which will not show a fast rise time signal very well. I would recommend using Schmitt gates to clean up the signal edges.

Depending what type of data connection you plan to have from the PIC will determine the PIC type, staying with a 5v system IMO is the best way to go.

You could drive the project from a small SLA 6V battery, using a low voltage drop out 5Vreg.... for weeks if need be.
 
Last edited:
Thanks for your help and suggestions eric!

I was doing some further thinking and wondered why not simply run the sensors (LD261 IR LED and BPX81 phototransistor) from Vcc of 3.3V

Then I could use the 3.3V MSP430 microcontroller (readily available and experienced peers to help use it) and the inputs will directly accept the 3.3V logic from the 74HC14 chip.

Is there anything I'm missing here? any reason to have to run the sensors at the usual 5v?

I have read in Texas instruments docs (hopefully correctly) that if your only writing to a LCD module it can accept 3.3V signals but most will still need need 5v power. This way all I'll need is a 5v regulator to power an LCD module only.

seeing as I'm only going to output calculated info on the LCD i figure I will only be writing to it.... will this work? or again i might be missing something...

The suggestion of using LDO regulators was appreciated however SLA batteries will be too big/heavy. A quality 9V lithium battery 1200maH should suffice?

Thanks again.
 
Being that it's an absolute encoder, and not a sequential one, I wouldn't think that edge quality would be all that important. I doubt the error would be significantly worse if the sample was taken right at the edge transistion. You're gray conding already took care of most of the error.

Just a thought....
 
You could save a lot of power by turning the LEDs off until you want to take a reading. And BrownOut is right, if you take a reading on the edge its value doesn't matter with a gray code. That is, as long as you aren't clocking anything with that edge.
 
After giving this a little more thought, I'd go ahead and use schmitt gates, at least on the front end. Although not required for encoder accuracy, they would produce definite levels for your cmos logic, which tends to just work better that way.
 
Last edited:
Thanks for all the help everyone. Turning off the LEDs is a very sensible idea inbetween readings.

I did some testing yesterday and managed to get the forward current of the IR LED down a fair bit. Most application notes and datasheets advise around 20mA running through the LED but seeing as I'm directly focusing it into the phototransistor about 4mm apart it seems fine with about 4-5mA forward current.

This should also improve battery efficiency quite a bit.

The sensor system seems to be working fine biased with 3.3V Vcc can anyone comment on this. why do we see all (well the majority from what i've seen) application notes and projects using 5V Vcc for the IR LED and phototransistor operation?
 
After giving this a little more thought, I'd go ahead and use schmitt gates, at least on the front end. Although not required for encoder accuracy, they would produce definite levels for your cmos logic, which tends to just work better that way.

Yes after testing yesterday, I will be using a low voltage hex schmitt interver IC. made it rock solid with differing distances and code disk thicknesses.
 
The sensor system seems to be working fine biased with 3.3V Vcc can anyone comment on this. why do we see all (well the majority from what i've seen) application notes and projects using 5V Vcc for the IR LED and phototransistor operation?

hi,
The early MCU's & TTL logic devices operating voltages were specified as 5V, so 5V is an early standard.
 
I have another quick question... I have just noticed that the output drive current of the SN74AHC14 hex schmitt trigger is +/- 4mA for Vcc 3.3V. is this too low? There are other low voltage logic families e.g. SN74LVC14 which have a +/- 24mA drive current capability, but not in a PDIP package which i require.

I am going to input 4 phototransistor output signals (3.3V) into each hex schmitt inverter, and then the outputs will be inputted to a PIC18LF4520 running at Vcc 3.3V.

I am not entirely sure how the output drive current affects me in this case. I think its fine as im only inputting the signal to a PIC which isnt a current hungry load like a motor or something
 
Last edited:

hi,
The PIC inputs require very low currents as they are CMOS technology.
A 74AHC14 should have no problems in driving PIC input pins.
 
Hi Everyone,

I have a circuit diagram that I have made up in Eagle CAD and would like to ask a couple of questions regarding the connection of the LCD module.

The LCD module is a 3.3V module, and can be either hooked up in 4-bit or 8-bit modes. Seeing as I'm using a fairly full featured 8-bit PIC (PIC18LF4520), I thought I'd better run it in 8-bit mode which, from what I have researched, will made communication with the LCD via C code easiest no 2X4bit 'nibbles'.

In my circuit diagram I have realised that the way I have it set up is not exactly right as I should isolate pins 39 (PGC) and 40 (PGD) for programming (ICSP) with a PICkit2 clone programmer. I thought I could use a jumper on each to connect/disconnect these lines from the LCD. The other way I have read is to use a resistor but I'm not sure if this is a valid/good way of isolation?. So then I thought maybe I should not use PGC & PGD at all and re-think the way I wire the LCD to the PIC.... Do DB0-7 LCD connections need to be on one port of the PIC ie RB0-7 or RC0-7? or can they be split over two ports without making things hard...

I like the way it is connected now simply because it will be neat to construct on stripboard with a header and socket connection to connect the LCD....rather than having say half of the connections coming from the left side of the PIC and the rest from the right.

Or is it not too bad running it in 4-bit mode to free up PGC & PGD and have all wires connected to the right hand side of the PIC.

What are peoples suggestions?

View attachment Schematic..pdf
 
hi s7,
You can use other port pins for the LCD control lines, I would keep the LCD data lines on the same port.
Using 4 bit data to the LCD will free up 4 PIC pins for other work if required.

Ref the programming pins, if you have a spare prommer connector header, you could connect the internal wires to the PIC via the spare header.
Unplug the spare header when you want to program the PIC.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…