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.

Having problem with switches

Status
Not open for further replies.

nygge

New Member
Hello! My friend and I are building a robot that will sense when he is bumping into things through switches. But the PIC (16F690) is always detecting the switches on. I am wondering if anyone have got a clue about what the problem could be? When the PIC is on the testingboard everything is as it should be but when we put it onto the "robot" it all goes crazy.
And one more thing, how can I set the minimum input voltage on an input?
I am programing with c and htc.h library.
 
can you post code and schematics? of just that part...

I think you might not have PULL UP/DOWN resistors.... or maybe the ADCON1 isnt setup right...
 
Hi nygge and atomsoft,

if everything is working correctly on the "testing board" then i think when you are porting it on to your robot some connections get loosened. Like atom soft pointed out, you should have Pull up/ Pull down resistors on interrupts.Ensure that all connections are nice and sturdy.

What do you mean by the minimum voltage on an input? you are using interrupts, you are using switches? where does the AD converter come in between? Switches are binary devices. If you are using the AD module then it depends on the reference voltages that you have set.
 
Last edited:
Well when the PIC is on the testingbord and I simulate the buttons it works so i think that it is the "Robot" that has some functional problems.. We have tested all the components with a multimeter and it's all working. But when we connect the PIC with the robot and it starts to run the motors the PIC starts to complain about the sensors being on.

I will send a schematic as son as possible.

But here is the code. View attachment robot main..c
 
Well when the PIC is on the testingbord and I simulate the buttons it works so i think that it is the "Robot" that has some functional problems.. We have tested all the components with a multimeter and it's all working. But when we connect the PIC with the robot and it starts to run the motors the PIC starts to complain about the sensors being on.

I will send a schematic as son as possible.

But here is the code. View attachment 39858

How are you "simulating" switches, they are either yes or no. Is there any control circuitry on the robot except the motor control one? Cause you can easily check the motor control circuit if attached to the robot individually with out any interrupts then connect the testing board. From what you describe with the ROBOT going crazy it looks like you dont have a pull down/ up resistor and thus infinite interrupts are being generated.
 
Last edited:
Now we have schematics on the circuit, but it some componets didn't exist in the program I used so I have take some other instead and it doesn't look so pretty.
 

Attachments

  • Robotcircuit..PNG
    Robotcircuit..PNG
    83.8 KB · Views: 160
The h-bridges are completely wrong. The motor won't reverse, it'll be either on or off and will turn very slowly at just over 4V; it's fed by emitter followers on the high side and the bases will be biased at 5V .
 
The supply to the " H-bridge" is 3 v coming out from the LM317 right? which is connected to the collector and the base is being supplied with 5v? But this then forward biases the CB junction doesnt it?. Also like Hero pointed out you " H-Bridge" is wrong since it will only turn on the motor in one direction. Also are you sure you have connected the LM317 as specified in the data sheet? See LM317 connections here

**broken link removed**

Also look for how to make an H bridge. Have you used low power motors? I have seen ones rated at 5v but this is the first time i see a motor being operated at 3v.
 
Last edited:
The supply to the " H-bridge" is 3 v coming out from the LM317 right? which is connected to the collector and the base is being supplied with 5v? But this then forward biases the CB junction doesnt it?.
You're right about that.

The schematic is very confusing - an OR gate symbol has been used for the LM317.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top