Chapter 36 Soldering Circuit Board

Project 36.1 Soldering a Buzzer

We have tried to use a buzzer in a previous chapter, and now we will solder a circuit that when the button is pressed, the buzzer sounds.

This circuit does not need programming and can work when it is powered on. And when the button is not pressed, there is no power consumption.

You can install it on your bike, bedroom door or any other places where it is needed.

Component List

Pin header x2

Resistor 220Ω x1

Active buzzer x1

Chapter36_00

Chapter01_04

Chapter07_01

LED x1

Push button x1

AA Battery Holder x1

Chapter36_01

Chapter02_02

Chapter36_02

Circuit

We will solder the following circuit on the main board.

Schematic diagram

Hardware connection

If you need any support, please feel free to contact us via:

support@freenove.com

Chapter36_03

Chapter36_04

Soldering the Circuit

Insert the components on the main board and solder the circuit on its back.

../../../_images/Chapter36_05.png

rendering after soldering:

Front

Back

Chapter36_06

Chapter36_07

Testing circuit

Connect the circuit board to power supply (3~5V). You can use ESP32 board or battery box as the power supply.

../../../_images/Chapter36_08.png

Press the push button after connecting the power, and then the buzzer will make a sound.

Project 36.2 Soldering a Flowing Water Light

From previous chapter, we have learned to make a flowing water light with LED. Now, we will solder a circuit board, and use the improved code to make a more interesting flowing water light.

Component List

Pin header x5

Chapter36_00

Resistor 220Ω x8

Chapter01_04

LED x1

Chapter01_03

74HC595 x1

Chapter15_00

Circuit

Solder the following circuit on the main board.

Schematic diagram

Hardware connection

Chapter36_09

Chapter36_10

Soldering the Circuit

Insert the components on the main board and solder the circuit on its back.

../../../_images/Chapter36_11.png

Rendering after soldering:

Front

Back

Chapter36_12

Chapter36_13

Connecting the Circuit

Connect the board to ESP32 with jumper wire in the following way.

../../../_images/Chapter36_14.png

Sketch

The following is the program code:

 1/**********************************************************************
 2  Filename    : FlowingLight02
 3  Description : Use 74HC575 to drive the ledbar to display the flowing light.
 4  Auther      : www.freenove.com
 5  Modification: 2024/06/19
 6**********************************************************************/
 7
 8int latchPin = 12;          // Pin connected to ST_CP of 74HC595(Pin12)
 9int clockPin = 13;          // Pin connected to SH_CP of 74HC595(Pin11)
10int dataPin = 14;           // Pin connected to DS of 74HC595(Pin14)
11
12void setup() {
13  // set pins to output
14  pinMode(latchPin, OUTPUT);
15  pinMode(clockPin, OUTPUT);
16  pinMode(dataPin, OUTPUT);
17}
18
19void loop() {
20  // Define a one-byte variable to use the 8 bits to represent the state of 8 LEDs of LED bar graph.
21  // This variable is assigned to 0x01, that is binary 00000001, which indicates only one LED light on.
22  byte x = 0x01;    // 0b 0000 0001
23  for (int j = 0; j < 8; j++) { // Let led light up from right to left
24    writeTo595(LSBFIRST, x);
25    x <<= 1; // make the variable move one bit to left once, then the bright LED move one step to the left once.
26    delay(50);
27  }
28  delay(100);
29  x = 0x80;       //0b 1000 0000
30  for (int j = 0; j < 8; j++) { // Let led light up from left to right
31    writeTo595(LSBFIRST, x);
32    x >>= 1;    
33    delay(50);
34  }
35  delay(100);
36}
37void writeTo595(int order, byte _data ) {
38  // Output low level to latchPin
39  digitalWrite(latchPin, LOW);
40  // Send serial data to 74HC595
41  shiftOut(dataPin, clockPin, order, _data);
42  // Output high level to latchPin, and 74HC595 will update the data to the parallel output port.
43  digitalWrite(latchPin, HIGH);
44}

In fact, this code is copied from chapter 15. If you have any questions for the code, please click “Chapter 15 74HC595 & LED Bar Graph” to return to Chapter 15 to study again.