Good,
I am trying to create a thermostat with a relay, so far so simple, the problem is that the relay sometimes clicks and the heating starts to work and sometimes it doesn't. I am trying to create a thermostat with a relay.
The led lights up and it sounds as if the relay is trying to work, but it doesn't close the circuit.
I attach the schematic diagram (sorry for the design).
I am surprised the Arduino is still working. You need to use a mechanical relay that has the appropriate interface for the processor, or a solid state one also designed for microprocessor inputs. Here are a few good rules to follow.
Gil's Crispy Critter Rules:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Rule #3 when first starting out, add a 220R resistor in series with both Input and Output pins. (LarryD)
Rule #4 buy a DMM to measure voltages, currents and resistance. (LarryD)
Violating these rules tends to make crispy critters out of Arduinos. An appropriate relay:
Good afternoon,
thank you very much for your reply.
About the font, I didn't put that part of the design because I didn't think it was important.
I am actually powering the circuit with a 5v power supply.
@udelunar change your circuit. The LED shoukd not be in series with the resistor to the base of the transistor.
Wire the LED and a 1K resistor between the D5 output and ground. D5 HIGH will illuminate the LED.
Wire a 1K resistor between the D5 output and the base of the transistor. D5 HIGH should now turn on the transistor and make your relay (or relee) pull in decisively.
I am sorry to say I feel you are not quite ready to start the project at this point. We have no idea of your skill set or what resources you have available to you. I would suggest you start with some of the tutorials that are on line, sorry to say some are not so good but many are very good. Start by learning the basics, you will need to control outputs as well as interpret inputs such as reading a switch, receiving a message etc. Start with the LED, they are not expensive and there is even one on most of the Arduinos. At this point
you should have also found several tutorials on basic electronics that you have gone through. You should acquire a copy of the Arduino Cookbook and go through that. I have no clue as to how fast you will learn this but it will probably take a few months. During this process you will learn what an IDE is
and how to use it to generate and upload your code to the Arduino. Let us know how you progress.