I build a standalone board for my ATMEGA328P-U chip according to this tutorial (which should be the same as this).
My schematic should look like this
On my real perfboard I have 2 GND lines and 2 5V lines (one pair on each side). I verified that these are 5.02 V.
Pin - Voltage
7 - 5.02V
20 - 5.02V
21 - 5.02V
19 - 0.558V
3 - 1.15V
4 - 1.15V
5 - LOW
All Pins that should connect to GND read a voltage near 0V.
Using the following code
int relayp1 = 1; // LED on Pin 13 of Arduino
int relayp2 = 2; // LED on Pin 13 of Arduino
int pirPin = 3; // Input for HC-S501
int LED = 19; // Input for HC-S501
int pirValue; // Place to store read PIR Value
void setup() {
pinMode(relayp1, OUTPUT);
pinMode(relayp2, OUTPUT);
pinMode(LED, OUTPUT);
pinMode(pirPin, INPUT);
digitalWrite(LED, HIGH);
digitalWrite(relayp1, HIGH);
digitalWrite(relayp2, HIGH);
}
void loop() {
pirValue = digitalRead(pirPin);
if (pirValue == HIGH)
{
digitalWrite(relayp1, LOW);
digitalWrite(relayp2, LOW);
delay(120000);
digitalWrite(relayp1, HIGH);
digitalWrite(relayp2, HIGH);
}
else
{
//Safe! Continue usual tasks...
}
}
Not shown in the schematic, I use a HC-SR501 PIR motion detector which is connected to Pin 5 (D3). Pin 3 and 4 are connected to a relay.
The setup does work on the breadboard, using power directly from my arduino uno clone.
The standalone board is powered by a 12V, 1.5A power supply.
As you can see, the output voltages are too low. Besides that, the LED is not powered. I uploaded another sketch, that should switch Pin 3 and 4 HIGH for 5s and LOW for 5s.
int relayp1 = 1; // LED on Pin 13 of Arduino
int relayp2 = 2; // LED on Pin 13 of Arduino
int pirPin = 3; // Input for HC-S501
int LED = 19; // Input for HC-S501
int pirValue; // Place to store read PIR Value
void setup() {
pinMode(relayp1, OUTPUT);
pinMode(relayp2, OUTPUT);
}
void loop() {
digitalWrite(relayp1, LOW);
digitalWrite(relayp2, LOW);
delay(5000);
digitalWrite(relayp1, HIGH);
digitalWrite(relayp2, HIGH);
delay(5000);
}
Ignore the female PIN headers.
I measure 1.15V still. So I assume the chip is not properly working on the breadboard. Any ideas what to check next?