Author Topic: Battleswitch  (Read 4011 times)

0 Members and 1 Guest are viewing this topic.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Battleswitch
« on: August 10, 2008, 03:18:05 PM »
Hi,

I'm curious how I can connect the Battleswitch to the axon using the following diagram.
http://www.dimensionengineering.com/datasheets/Battleswitch-diagram.jpg
I tried connecting SC terminal to PC0 (Input) and S1 to PC0 (-)

Code: [Select]
int i=0;
int j=0;

cbi(DDRC, PC0);  //set C0 as input pin


i = bit_is_clear(PINC, 0);
j=bit_is_set(PINC, 0);

I toggle the battleswitch with my RC Transmitter, but for some reason it always registers that j is set to 1 meaning true
and i is 0 even after I toggle the battleswitch off.

Please advise me on what I'm doing wrong either in code or my connections to PC0.

« Last Edit: August 10, 2008, 03:25:35 PM by vidam »

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Battleswitch
« Reply #1 on: August 10, 2008, 03:31:36 PM »

Just to recap, here is the correct wiring instructions for the Battleswitch to Axon.


S1 (battleswitch) connects to Axon 3.3 Volt (+) on SV23
SC (battleswitch) connects to Axon 3.3 Volt (-) on SV23

See Axon schematic.

Then a second connection connects from S1 (battleswitch) to Axon PC0 (Input).

Then you can write your code as I did in the first post and the following output:

When Battleswitch Green LED ON j=1 and i=0;

When Battleswitch Green LED OFF j=0 and i=1;

Green LED is toggled by the RC Transmitter.

When RC Transmitter is off, then i=1 and j=0;
« Last Edit: August 10, 2008, 05:16:31 PM by vidam »

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Battleswitch
« Reply #2 on: August 10, 2008, 05:11:16 PM »
 A method that I thought would worked didn't. I connect Battleswitch S1 and SC to Axon PC0(+) and PC0(-) and then read the value of Battleswitch S1 on Axon PCO (input). However this wiring shuts down the power on the Axon and the red power light went out for some reason.

I was wondering if Admin can explain why Axon shuts off in this wire setup?
« Last Edit: August 10, 2008, 05:18:39 PM by vidam »

paulstreats

  • Guest
Re: Battleswitch
« Reply #3 on: August 10, 2008, 06:05:45 PM »
If youre connecting 1 pole of a switch to a positive power rail and the other pole of the switch to the ground(-) power rail then it is obviously going to short the power supply and cause the axon to shut down.

Try just connecting the SC on the battleswitch to the +ve rail (pc0(+)) and S1 to an input port on the axon. (This will drive the port high). To get a good differential between 0 and 5v on the input pin you will need to employ the use of a pull down resistor. I think there is a tutorial about using switches that explains pull down resistors. Also you might also want to look at adding a debouncing circuit to the switch

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Battleswitch
« Reply #4 on: August 10, 2008, 06:37:35 PM »

Try just connecting the SC on the battleswitch to the +ve rail (pc0(+)) and S1 to an input port on the axon. (This will drive the port high). To get a good differential between 0 and 5v on the input pin you will need to employ the use of a pull down resistor. I think there is a tutorial about using switches that explains pull down resistors. Also you might also want to look at adding a debouncing circuit to the switch

I tried this configuration without the pull down resistor and the voltage fluctuated in the millivolt range. And the readings I received from the Axon port were not repeatable. I'm not going to mess with this any longer. I found that connecting S1 to 3.3V(+) and SC to 3.3(-) and S1 to PC0(input) worked repeatably. By repeatable I mean that I could duplicate the pin input over several different experiments.

So I'm happy with this setup. My focus now is to write code to process the RC signals for throttle and steering channels of the RC transmitter/receiver pair using the axon.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: Battleswitch
« Reply #5 on: August 10, 2008, 06:46:47 PM »
I'm confused about your wiring . . .

Quote
S1 (battleswitch) connects to Axon 3.3 Volt (+) on SV23
SC (battleswitch) connects to Axon 3.3 Volt (-) on SV23
Quote
I connect Battleswitch S1 and SC to Axon PC0(+) and PC0(-)

and from battleswitch datasheet:
S1 to battery for motor
SC goes to motor out
S2 goes to ground


And I'm not entirely sure what you're trying to do:
Quote
and then read the value of Battleswitch S1 on Axon PCO (input)
Why are you reading the value?


If you are trying to control a motor using the Axon with the battleswitch, you are supposed to hook it up as if it was just a normal servo. Just follow the battleswitch datasheet for the connection.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Battleswitch
« Reply #6 on: August 10, 2008, 06:55:27 PM »
I'm confused about your wiring . . .

Quote
S1 (battleswitch) connects to Axon 3.3 Volt (+) on SV23
SC (battleswitch) connects to Axon 3.3 Volt (-) on SV23
Quote
I connect Battleswitch S1 and SC to Axon PC0(+) and PC0(-)



I think you misquoted me: The second post said "Then a second connection connects from S1 (battleswitch) to Axon PC0 (Input). "

Quote
and from battleswitch datasheet:
S1 to battery for motor
SC goes to motor out
S2 goes to ground


And I'm not entirely sure what you're trying to do:
and then read the value of Battleswitch S1 on Axon PCO (input)
Why are you reading the value?


If you are trying to control a motor using the Axon with the battleswitch, you are supposed to hook it up as if it was just a normal servo. Just follow the battleswitch datasheet for the connection.

Blah too many [quotes]

I solved my problem. I'm not using the Battleswitch for controlling my motors. I'm using Battleswitch to switch between Autonomous mode and RC mode using the third channel of my transmitter to toggle it using the Battleswitch. So my third channel acts as a failsafe switch in effect.

I'm on to bigger things now.
« Last Edit: August 10, 2008, 06:56:54 PM by vidam »

 

SMF spam blocked by CleanTalk