Hey there, circuit lovers. In this post, we’ll give some simple circuit examples with popular Arduino parts that we add to circuito.io. We’ll be updating new circuits and project ideas to this list from time to time so that you can make cool things with the new Arduino parts we add. In the future, we’ll also be adding parts and circuits for other microcontrollers as well.  You can use these circuit examples as a starting point, and alter them to your needs. We’ll also throw in some explanations about the parts themselves and the code logic of the circuit, so you can learn something new along the way.

The first Arduino parts we are going to cover are 5 components that have already been on our app for a while, but we recently added code for them:

  • RGB LED strip
  • 4 digit 7 segment display
  • Micro switch
  • Push pull solenoid
  • LCD 20×4 I2C

Before we dive into the circuits, here’s a quick reminder about the circuito.io code:

How to Check Whether or Not a Component Has Code

There are two ways to check whether or not the part you want to use has a test code and code libraries on circuito.io.

  1. Hover over the component, and you’ll see 3 checkboxes. The first says “test code”. If it has a green checkmark next to it, the component has code. If it doesn’t,  you’ll either have to find the right code libraries or wait for our next update, because we also add code from time to time
  2. Click on the desired part > more info. Under the component image, you’ll see the checkboxes again.

test code arduino parts

How to Use the Test Code in Your Circuit

The code from circuito.io is a test code. This means that it has basic functionality to check that the components are wired up properly. However, most of the test codes also have libraries for the component, which have common functions and commands that can be very useful for your project, especially if you’re a beginner. To learn how to use our test code and other useful information about Arduino code, visit our Arduino code blog post.

Now that we know where the code is and how to use it, we can take a look at the circuit examples!


LED Dimmer

In this circuit, we are going to learn how to dim an RGB LED strip using a potentiometer. The strip is comprised of 60 LEDs per meter, connected in parallel. Each color channel (R/G/B) is controlled separately, driven by a MOSFET (transistor) controlled by PWM. Setting the PWM value, will drive all the LEDs in the strip.

Click here or on the diagram to go to the app >>

LED Strip potentiometer Arduino parts

What Does the Potentiometer Do?

The potentiometer controls the intensity of the LEDs. Rotating the knob changes the value read by the Arduino. This happens because of the resistance relation between the 3 pins of the potentiometer changes. This causes the voltage in the middle pin to change as well. The readings from the potentiometer determine the intensity of light emitted from the LEDs.

LED Dimmer Code

The potentiometer is an analog component, therefore, it’s connected to the Arduino ADC pin. This means that the values read by the Arduino will be in  the range between 0-1023. In order to translate the ADC values to PWM values (required by the LEDs) – 0-255, we use the map() function, which is then stored in potentiometerVal variable. Using this variable, we can determine which color we want to control on the LED strip – Red, Green or Blue. The color and intensity of the LEDs will change according to the potentiometer readings and the color we decided to control.

LED dimmer

You can find the code for this circuit in our Github repo. Remember to adjust the pin numbers according to the generated code you got from circuito.io.

Get Code for This Project

Humidity and Temperature Monitor

The 3 main components of this circuit are the DHT22 temperature and humidity sensor, push button and a 4 digit 7 segment display. We’ll display the temperature and humidity on the 7 segment display and toggle between them, using the push button.

Click here or the diagram to go to the app >>

Arduino parts Humidity temperature display

What Does the Push button Do

The pushbutton is connected on one side to 5v and on the other side to the GND through a resistor. Using an Arduino digital pin, we are going to determine whether the button is pushed or not. When the button isn’t pushed, the reading is 0. When pushed, the reading is 1.

Humidity and Temperature Monitor Code

The pushbutton.onPress() function returns the value 1 upon press. When this happens, the display state, which is stored in a boolean variable (since it only has 2 states), will toggle between the states. In the code, this is done using the ‘not’ (!) command. This means that every time the button is pushed, the input to the 7 segment will change.

After the state is defined, it is used to decide which data to display:

  • if the state is 0 –  the 7 segment display will present the temperature,
  • if the state is 1 – it will display the humidity.

arduino parts for humidity and temperature monitor

You can find the code for this circuit in our Github repo. Remember to adjust the pin numbers according to the generated code you got from circuito.io.

Get Code for This Project

3D Printer Limit Switch

In this circuit we’ll use a microswitch as a limit switch for the stepper motor, in the same way it’s implemented in the calibration setup of 3d printers. We’ll configure the microswitch to change the direction of the stepper motor, every time it’s pressed. You can also set the stepper motor to stop upon press.

Click here or on the diagram to see it on the app >>

3d printer limit switch

What Does the Micro Switch Do

The microswitch in this circuit functions in the same way as the pushbutton does in the previous circuit – when the switch isn’t pressed, the reading is 0. When pressed, the reading is 1.

Limit Switch Code

The microswitch.onPress() function returns the value 1 upon press. This simulates the 3D printer calibration and indicates that the axis has reached its limit. When this happens, the motor changes its direction state, which is stored in a boolean variable. This variable is then used in the digitalWrite function on the DIR pin of the ‘Easy Driver’ using digitalWrite(DIR, state).

arduino parts for 3d printer limit switch

You can find the code for this circuit in our Github repo. Remember to adjust the pin numbers according to the generated code you got from circuito.io.

Get Code for This Project

Arduino Clock

For the Arduino clock circuit we’ll use an  RTC (Real Time Clock) and an LCD i2c. We’re going to be presenting the time and date on the LCD according to the data received from the RTC. The data will be presented on the screen according to our settings.

We need to set:

  • What data will be displayed
  • How it will be displayed
  • Where it will be displayed

Click here or on the diagram to go to the app>>

arduino clock

What does the RTC do?

As its name implies, the RTC keeps track of the time and date. We are using an RTC module that connects over I2C to retrieve the time and date. The RTC lib does all the communication settings for us. When the RTC doesn’t have power it loses track of time. It is possible to insert a coin battery in order to prevent power loss. Since the RTC has a very low power consumption, the coin battery will last for ages.

Arduino Clock Code

In the setup phase, it is important to adjust the starting time and date on the first startup of the circuit. In the code, this is done by: rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); which gets the current time from the IDE when uploading the sketch.

rtc.now() function will provide us with a data structure holding the current time and date readings. These will be displayed on the LCD using LCD.print() function.

The LCD library provides a few different methods for determining the print location and format on the screen.

arduino parts for arduino clock

The code for this circuit is on our Github repo. Remember to adjust the pin numbers according to the generated code you got from circuito.io.

Get Code for This Project

Code-Protected Door Lock

This circuit will implement a simple code-protected door lock. We used a lock-style solenoid that opens when the correct code is entered.

Click here or on the diagram to go to the app>>

code protected door lock

What Does the Keypad Do

The keypad is constructed as a 3X4 connection matrix. Pressing one of its keys will cause a short between a row pin and a column pin. This way, the Arduino knows which key was pressed.

Door Lock Code

The code maps the keypad buttons into keys, using 2D array. You can set the mapping to whichever characters you want.

In the main loop, the keypad is read continuously, detecting one press at a time. Each press will return a value from the mapping array. This value will be chained into a string, constructing the password. Once the string reaches the correct length, it is compared with the predefined password. If they match, the lock will be released. If it doesn’t, the string is cleared.

arduino parts for code protected door lock

The code for this circuit is on our Github repo. Remember to adjust the pin numbers according to the generated code you got from circuito.io.

Get Code for This Project

That’s it for now! We’ll update on our facebook page once we add more circuits.

If you have any questions, write to us in the comments below or contact us through our community forum.