Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC circuit help

Status
Not open for further replies.
Finally managed to produce a circuit diagram for this, and would welcome help on the original question again. I have since simplified the circuit to remove various transistors and seven segment displays, and now it uses just an LCD display and a couple of switches, plus a few other supporting components.

The original problem still exists - if I remove the resistor R2, the circuit behaves as though the interrupt used for the hall effect is continually firing, resulting in a speed reading of about 196mph even though the hall effect switch is not being activated. Put R2 back in and the circuit is stable again.

I tried switching to a 12v car battery in case the 'wall wart' was producing noise, and using a 7805 with it. This results in about 4.85v supply voltage. This made no difference to the problem and additionally at this level, the PIC doesn't seem to behave correctly - it often fails to read values correctly from the EEPROM data, which is a bit weird but maybe this is all caused by whatever my circuit issue is anyway.

I obviously have the backlight on the LCD connected (through a 270ohm resistor), and the contrast is also connected through a resistor. These aren't on the schematic but they are in the circuit. LCD output is working properly.

I tried putting a 0.1uf capacitor across the power pins as suggested, but this had no effect either.

Thanks,
Richard.
 

Attachments

  • speedo.png
    speedo.png
    22.1 KB · Views: 141
What are the output voltage levels of the Hall Effect sensor?

The PIC has to understand the low and high levels. Adding resistors in series with the power line is a bad idea without the capacitor accross the PIC pins. Changing the supply voltage with the resistor will change the threashold voltage of the PIC input, so you could be altering what the PIC sees as a high level.
 
Diver300 said:
What are the output voltage levels of the Hall Effect sensor?

The PIC has to understand the low and high levels. Adding resistors in series with the power line is a bad idea without the capacitor accross the PIC pins. Changing the supply voltage with the resistor will change the threashold voltage of the PIC input, so you could be altering what the PIC sees as a high level.

I don't want the series resistor there as it doesn't normally seem to be required - it's just that it doesn't work unless I have it there. Using the wall wart, with the series resistor in place but no capacitors across the power pins of the chip, the hall sensor outputs 5.19v. I've put a cap in; it still works but still only with the series resistor in place.

Incidentally, the problem is the same even if the hall sensor is not connected to the circuit. It seems to be some sort of noise issue in the circuit to me, but I don't know how to correct it or where it is.

It is still unreliable at startup as well - sometimes the eeprom values are successfully read, and other times they are not. Especially if I try to power it from the 12v source via a 7805.

I'm beyond the limits of my electronics knowledge here - I'm a software engineer by trade!
 
Incidentally, is there any clue in the fact that when I connect the ground lead for my oscilloscope to the circuit, the "noise" problem disappears? I presume I'm effectively grounding the circuit through the scope in doing this.
 
The way you have R3 & R4 connected looks wrong. The way you have them connected results in the inputs to the PIC (RB0 & RB1) floating when the switches are open. You should have pulldown resistors on the switch lines instead.
What is the part number of the Hall Effect device? If it has an open collector output, it would need a pullup resistor.
Final question: Are all the resistors 270:eek:hm:?
 
kchriste said:
The way you have R3 & R4 connected looks wrong. The way you have them connected results in the inputs to the PIC (RB0 & RB1) floating when the switches are open. You should have pulldown resistors on the switch lines instead.
What is the part number of the Hall Effect device? If it has an open collector output, it would need a pullup resistor.
Final question: Are all the resistors 270:eek:hm:?

Thanks for that. Looking at my schematic again, I think I haven't actually drawn the switches in the same way as they are connected to the circuit :eek:

I actually have them connected such that one side of the switch is connected to ground, and the other side is connected directly to the PIC. I then have a second connection from the pic through a 270ohm resistor to the +5v rail. So with the switch open the pin should be high, and it should be pulled down to ground when the switch is closed.

I have software running from the interrupts generated by the switches and this part of the application is working fine, even while the speed reading is going bonkers.

Will update the schematic later :eek:
 
Last edited:
kchriste said:
What is the part number of the Hall Effect device? If it has an open collector output, it would need a pullup resistor.QUOTE]

The hall effect device is a Honeywell SS443A
 
I would check if your sensor can be interfaced to the microcontroller directly or it requires a pull-up resistor.

R3 and R4 can be increased so that they draw less current; we've been discussing this issue here.



EDIT: schematic added.
This is how I would connect the sensor.
 

Attachments

  • speedo2.png
    speedo2.png
    7 KB · Views: 125
Last edited:
eng1 said:
I would check if your sensor can be interfaced to the microcontroller directly or it requires a pull-up resistor.

R3 and R4 can be increased so that they draw less current; we've been discussing this issue here.



EDIT: schematic added.
This is how I would connect the sensor.

Thanks for that. Will take a look this evening :)
 
As suggested, dump the 270 ohms in the 5V feed, they aren't required, and shouldn't be there - ensure you add suitable decoupling capacitors near the PIC as well. As also suggested, the 270 ohm pullups are FAR too low, change them for between 10K and 100K.
 
Thanks for the input on this problem. I now have it working.

I have put;

- a capacitor across each pair of power pins (.1:mu:f)
- I've swapped out the 270:eek:hm: pullups on the switches for 51k's
- the series resistor on the power pins is gone
- A pull-up resistor, 3.7k was closest I had to suggested value, installed for the hall-effect connection to the pic as suggested by eng1.

I now have a working and stable circuit :)

Many thanks to all those who offered help to this electro-dumbo. :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top