Tag Archives: Tutorial

Arduino Tutorial 55: Measuring Distance With HC-SR04 Ultrasonic Sensor

This lesson builds on the work done in Lessons 53 and 55. In this lesson we use the Ultrasonic Sensor to build a distance sensor. The HC-SR04 ultrasonic sensor can be programmed to send out a ping, and then measure the time it takes to hear the echo of the ping come back, after bouncing off a target. Knowing the speed of sound allows us to calculate distance to the sensor.

The circuit uses the following Schematic:

HC-SR04-Schematic
Schematic for Connecting the HC-SR04 to an Arduino

This is the code we develop in the video

The sensor is part of our Elegoo Kit , so if you get this kit, you will be using the same hardware we are using. This project builds on the work we did in Lesson 53.

For this build we will be using an Arduino Nano, which allows the project to be built on a single breadboard. You can use the Arduino Uno if you do not have a Nano, and things will work out the same. The build neatness is also facilitated by using small straight jumper wires, which you can get HERE.

Arduino Tutorial 40: Controlling DC Motor Speed and Direction with Pushbuttons

In this lesson we explore how to control the speed and direction of a DC motor using two buttons. We are using the L293D motor controller and a small DC motor for demonstration purposes. We are using parts from our Elegoo Super Stater Kit, which you can get HERE. The basic circuit was explained in Lesson 37, and we are using that work as a starting point. The schematic below will get you started in connecting your circuit. Be sure and connect one of the Arduino ground pins to the ground rail in the second to the bottom row in the diagram below. It is good practice to connect all your grounds together.

DC Motor Controller
Connection Diagram for a DC Motor Controller using the L293 Control Chip

The code we developed in the video lesson is shown below for your convenience.

 

Arduino Tutorial 36: Understanding How to Use Tilt Switches in Your Projects

Tilt Sensor
This Circuit Gives Visual Indicator if Board Has Been Tilted

This is a simple project that allows you to create a circuit which will give a visual indication if the breadboard has been tilted. In the upright position, the Green LED is illuminated. To the left of the board is a tilt switch. If the project is tilted, the switch will go from the closed to the open condition. This can be detected on the arduino, and then the red LED is illuminated. The video below explains how to do this simple project.

You can get the kit we are using in these lessons HERE. You should create your own code based on the instructions in the video, but if you are having trouble, I include the code developed in the video below:

 

Arduino Tutorial 33: Understanding How to Control Servos with a Joystick

In this lesson we show you how to precisely control the position of two servos using a joystick. We derive the math equations which will allow you to get smooth and precise control of the servo. We also add a buzzer to the project to create an audible alarm when the button the joystick is pressed.

If you want to follow along at home, you can order the Arduino Kit we are using HERE.

Typically, the servos in electronics kits are not the best ones, but are suitable to learn with. If you want a more stable and better quality servo, this is the one I user in more of my projects: HiTEC

Below is the code we developed in this project.