Hello, I am facing one issue while connecting the GND pin with digital pin of ATTiny2313, the microcontroller chip is start heating up like hot surface. I followed the below schematic to connect the pins and relay module. The relay module is working fine if I connect GND pin with specific digital pin but the microcontroller is getting too hot which means something wrong form my end.
In the above example, I connected the PIN#2 with GND of MC
code:
#include <digitalWriteFast.h>
#define SW1 2
#define RELAY_PIN 11
#define BLINK_LED_PIN 13
const byte opened = HIGH;
const byte closed = LOW;
void setup() {
digitalWriteFast(SW1, closed);
digitalWriteFast(RELAY_PIN, opened); // Initialize relay to off state
pinMode(RELAY_PIN, OUTPUT);
pinMode(SW1, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWriteFast(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWriteFast(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
int SWOut = digitalReadFast(SW1);
if (SWOut == 1) {
digitalWriteFast(RELAY_PIN, opened);
}
else{
digitalWriteFast(RELAY_PIN, closed);
}
}
The above code is working as expected but not sure why if I connect GND wire with digital pin is burning the microcontroller. When I disconnect this then the mc is getting normal. I cross checked my connections and there is no short circuit.
If the pin is set to be an input, it will only ever read LOW, which would be pointless.
If the pin it set to be an output, and you set it to HIGH, this would cause a damaging short circuit which would cause the Arduino to heat up and then burn.
Do not change your posts in a way that makes the replies you receive sound crazy. Anyone reading this thread will ask themselves why I could not see the ATTiny2313 in your diagram. They will think I am crazy. Do you want people to think I am crazy?
What are trying to do with this? Are you trying to use some sort of input to signal the controller to turn the relay on?
What was the purpose of P0 supposed to be?
please clarify what you're trying to do and you'll get better help.
It's a 2313 with only 2k of program memory. fastdigitalwrite is also small.
Check to make sure the arduino pin numbers used in your sketch match the pins on the chip. It's pretty uncommon for them to exactly match the chip pin numbers. (what "core" are you using, anyway? ATtinyCore says PD6 is pin 8, and PD0 is 0.) (Make sure your digitalWriteFast pin numbers match the pinMode pin numbers.
Set all unused pins to INPUT_PULLUP to prevent floating levels...
I'd be very tempted to skip the Arduino functions for this sort of app, and use direct port writes for everything. The whole "pin" abstraction loses a lot of its attractiveness in the absence of a standardized "board" with numbered pins.