PIC16F877A with DC Gear Motor

Home Forums Microcontrollers PIC Microcontroller PIC16F877A with DC Gear Motor

Tagged: ,

Viewing 11 posts - 16 through 26 (of 26 total)
  • Author
    Posts
  • #11492
    Ligo George
    Keymaster

    I think the problem is with type of switch you are using. You should use a micro switch, which will return to OFF state after the press. If you want to use ON – OFF switch you can add while(PORTD.F0 == 0); at end of if loop.

    #11496
    Shengo
    Participant

    Hi, thanks for your advice. It works now with a micro switch and with a slight change in the code.

     

    Sorry, keep bothering you with a question. Do you have any sample circuit or guide to interface an inductive proximity sensor with the PIC16F877A?

     

    Thank you very much.

    #11498
    Ligo George
    Keymaster

    Sorry, I don’t have any circuit or tutorials for interfacing inductive proximity sensors. Which sensor you are using ?

    #11500
    Shengo
    Participant

    It is a Proximity Switch 18mm in size, Inductive (NPN NO), with 10mm sensing range, 6V – 36V DC, Non-flush. It is a product of Taiwan which comes with 3 wires, brown to positive, blue to ground, and black to output.

     

    I have bought a 7805 to step down the voltage from the sensor to prevent the PIC from damage. Any idea how should I connect this to the PIC?

     

    Should I use a pull down resistor?

     

    Thanks.

    #11501
    Shengo
    Participant

    Edit, when I have interface the PIC with my relay with LED as output, the circuit works perfectly with the program of my PIC.

    But, when I change the output of the relay to motor, when I press the button, the motor would not turn on (the relay did not switch on also), but when I turn on the relay manually by connecting the input of relay to VCC, the motor works perfectly. It seems the input of my relay cannot detect anything from output of PIC when I switch the output of relay to motor, while when with LED it works perfectly.

     

    Any solution to this?

    #11502
    Shengo
    Participant

    Update again, sorry. The PIC interfacing with relay and motor has no problem now, sorry about the hassle.

     

    Now is just the interfacing my sensor with PIC, any suggestion how should I connect the proximity sensor to my PIC to allow it to have an output of 1 (into my PIC input 2) when sense something, and have an output of 0 (into my PIC input 2) when it does not sense anything?

     

    The specification of my proximity sensor is as shown in the previous 2 post, in order for my output of my sensor to work, I need to connect the black wire(output) to the load and then to the brown wire(positive) as it is a NPN sensor.

     

    Thanks.

    #11511
    Ligo George
    Keymaster

    You may use voltage dividing resistors and/or 5.1V zener diode to reduce the sensor output voltage down to 5.1V.

    #11525
    Shengo
    Participant

    Do you have any idea or suggestion how should I connect my sensor to my 2nd input of my PIC (RD1)?  I am really confused with the three wires, I know positive to brown, negative to blue, but in the circuit shown in the sensor it says that after connecting the black wire to my load, I need to connect the other side of the load to the brown wire again. I am really confuse how should I connect this to the PIC.

     

    Thanks.

     

    #11528
    Ligo George
    Keymaster

    Then connect a pull up resistor as a load. Connect one terminal of the resistor to positive and other terminal to black. And the same black terminal can be taken as output.

    #11540
    Shengo
    Participant

    Hi again, just finished the presentation for the robot today and it was really successful.

     

    Thanks again for all your guidance and help throughout this project. Cheers.

    #11541
    Ligo George
    Keymaster

    You are always welcome. Thanks for the feedback.

Viewing 11 posts - 16 through 26 (of 26 total)
  • You must be logged in to reply to this topic.
>