Please HELP...

Discussion in 'Embedded Systems and Microcontrollers' started by Minaco, Jun 14, 2009.

  1. Minaco

    Thread Starter New Member

    Jun 14, 2009
    3
    0
    Hi, I'm working on a robot controller by PIC16F877A, I've a DC motor driven by L298, and a rotary encoder mounted on the motor's shaft, the resolution of the encoder is 400 PPR, I take the signal from the encoder through a low pass filter and a Schmitt trigger, then an external counter divide the frequency by 16,
    Now when I power up the circuit and move manually the motor, the PIC counts right, after a certain number of pulses a led give me a signal.
    But when i connect the motor to the driver the PIC doesn't count correctly, it counts more pulses than the correct number, for example if the motor has to stop after 2 rotations, it stops only after a half rotation, that mean that the PIC counts false pulses.
    I think these false pulses come over from noise on the PIC that have to count the pulses, but i use 2 low pass filters, and a schmitt trigger,,,

    Someone can help me overcome this problem ???

    THANK YOU
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    It would be helpful if you can post up the circuit. Why do you feel you must filter the encoder output?
     
  3. Minaco

    Thread Starter New Member

    Jun 14, 2009
    3
    0
    Thank u all
    my motor require a lot of current, so i tried to isolate the L298 supply from the PIC supply and i used optocoupler, it worked well, but i have 2 question.

    In the isolation i used 2 different grounds, it's not good for me, i need to use only one ground.
    But if i use only on ground problems occur, so isolation is not valid, right ??
    And i need to feed back the current through the motor by a Shunt to the PIC, but this is not possible now because i have 2 grounds, so how may i isolate an analog signal ??

    THNX again
     
  4. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    A schematic is very important to give good help.
     
  5. Nanophotonics

    Active Member

    Apr 2, 2009
    365
    3
    Try use separate grounds for analog and digital signals. That could help.
     
  6. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    They may need to be common at one point so he can use one to control/measure the other. We can only hope for a schematic to clarify things.
     
  7. Minaco

    Thread Starter New Member

    Jun 14, 2009
    3
    0
    Here there's a schematic,
    now the problem is that the Vsense is referred to GND2 and the PIC ground is GND1, now how can I interface this analog signal (Vsense) with the analog input of the PIC?

    THANK U SO MUCH FOR THE HELP:)
     
Loading...