Now I connected the FET in as per datasheet. Grounding the signal line puts the bulb to light up :)- so far so good!
But putting signal line to PIN 13 (where I asked the LED to flash with 1Hz) the bulb remains always on :o ...Why???And what can I do against that?
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
The circuit:
* LED connected from digital pin 13 to ground.
* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.
Created 1 June 2005
By David Cuartielles
http://arduino.cc/en/Tutorial/Blink
based on an orginal by H. Barragan for the Wiring i/o board
*/
int ledPin = 13; // LED connected to digital pin 13
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
digitalWrite(ledPin, HIGH); // set the LED on
delay(500); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(500); // wait for a second
}
Can you guido me how to set the output to high impedance?
Now I connected the FET in as per datasheet. Grounding the signal line puts the bulb to light up
When you don't ground it does it go off?
It is not a FET calling it that will confuse people.
Can you guido me how to set the output to high impedance?
Just define the pin as an input to make it high impedance.
pinMode(ledPin, INPUT);
then to make it an output:-
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Hi Grumpy_Mike,
yes you are right- MOSFET is the wrong description.
As proposed I changed the code to:
int ledPin = 13; // LED connected to digital pin 13
void setup() {
// initialize the digital pin as an output:
// pinMode(ledPin, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
delay(1000);
pinMode(ledPin, INPUT);
delay(1000);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
The LED doesn't light up if the HEXFET is not connected. If the signal line is connected, the LED start blinking (not very bright) but the HEXFET doesn't stop leading current unless I disconnect....
HEXFET?! Its not a FET its an IC containing an output FET.
This device is NOT designed to be driven by a logic level, its Vin could be well above 5V, you may have risked destroying your Arduino. It is current driven, not voltage driven so its no surprise it didn't respond to a 5V output.
It should be driven by an open-collector output so at the very least you'll need a transistor to interface it, one rated at/above the voltage your bulbs are using (12v??).
You can then drive it solely in OUTPUT mode via the transistor and have the LED light up as you expect - and the switch will be on when pin13 is HIGH.
You need pin 13 to a resistor (10K or so will be fine) to the base of an NPN transistor, its emitter to ground and collector to the Vin of the switch IC.
I do not fully understand how to differenciate a Mosfet from a IC containing a FET. I read "Reverse battery protection by self turn on of power MOSFET".
Anyhow I used a 5cent BC639 to drive the BTS6143 and now it works...