When do I....

Please could someone clarify a few things for me:

  1. When building & testing my breadboard-circuit, do I build the circuit, and connect (the circuit) into a power supply once everything else - such as the LEDs and pushbutton etc - is connected? And if I need to touch/edit the circuit; I simply disconnect the power supply first?

  2. Can I (safely) use the Arduino/Genuino (Uno) as a power-supply-source meaning a battery etc is not needed?

  3. Do I upload my sketch to the Arduino before i build the circuit, or after I build my circuit - and am I able to (safely) do so while it is connected to the circuit? Or should i upload sketch to Arduino before connecting it to the circuit? With the presumption that the Arduino/Genuino automatically runs the last uploaded sketch.

Thanks in advance.

The safe way is disconnecting the single power supply when building or modifying the circuit. It becomes a bit more complicated when the Uno digital and supply outputs are not sufficient to power the circuit, and a power source of higher voltage or current is required. Then the first step should be to disconnect the external power supply, then turn off the Arduino (detach USB...). Attach in opposite order.

Before touching the circuit you should discharge yourself, by touching the common Gnd connection.

During upload of a sketch nothing can be connected to the Arduino Rx/Tx pins. If required, connect these lines after upload and press the reset button, in order to restart the controller from a well defined state.

Hi,

I'm a believer in Stepwise Refinement . So if you are making your own design and building the first version, think about the parts of the circuit and how you could test the first parts first, with a software sketch that does the minimum. Then start adding function and testing.

I like to separate almost any sketch into 3 sections:

  • Read Sensors
  • Make Decisions
  • Take Actions

Any system has some common elements; think about what they are for your design.

Maybe something like this:
HERE is example Arduino code that follows that idea:

Keep notes as you go along and take your time. Save each change of code with a new name/number so you can get back (Regress) to that code that worked..