Orange Arduino Pro Mini Starter Kit
Hello there, and welcome back. In this blog, we will discuss the orange Arduino Pro Mini Kit. In this kit, we will discuss how to use the Arduino Pro Mini as well as how to connect the LED, LDR, Switch, and other components to the Arduino.
Arduino Pro-Mini Introduction
When it comes to the Arduino pro-mini-board, it is a small, flexible, and low-cost controller. The only drawback in this board is that it does not include an onboard USB to TTL converter. As a result, to upload code to the board, you will need to use a USB to TTL converter.
We’ve included the USB to TTL converter in this orange starter kit so you don’t have to buy it separately.
Returning to the topic at hand, in the following section of the blog, we will discuss uploading the blink code to the Arduino Pro Mini.
How To Connect USB-TTL Converter To Arduino Pro Mini?
We’ll talk about uploading the code to the Arduino board in this section of the blog. And, as I mentioned earlier, there is no USB to TTL converter on the board, so we are using the following USB to TTL converter to upload the code to the board as well as make the connections shown in the image below.
So, now that the USB-To-TTL converter is connected to the board, we can upload the code to it.
The blink code will be uploaded to the board. We will discuss the Arduino blink code in the following section.
Uploading The Blink Code To The Board
In this section, we will write code to blink the onboard LED.
For those who don’t know, the Arduino Pro Mini has an onboard led that is connected to the Arduino’s PIN 13.
Unlike other microcontrollers such as the STM32, we do not need to set any registers on the Arduino board. You only need to write one line to change the mode of the pin. There’s no need to be concerned about memory mapping or any of the other steps.
But before setting the mode of the pin we will have to initialize the pin. And to initialize the pin we can use the #define keyword.
#define on board_led 13
After that, we can change the pin’s mode. We do not change the mode of the pin in Arduino programming. As a result, configuring the mode of the particular is a one-time task.
So, in Arduino programming, we get the void setup function for this type of one-time activity. This function is only called once, followed by the void loop function. In the void loop function, we can write our logic and have it run all the time the Arduino is powered on.
So far, we’ve covered the void setup and the void loop function. These two functions are required, and the Arduino code cannot be said to be complete without them.
So, now that you’ve learned about these functions, let’s put them to use.
As I previously stated, the void setup function is used to set the pin mode, but it can also be used for other purposes such as writing the initial setup, writing initial code and other similar tasks. However, that section of the code will only be executed once.
Coming back to the discussion, we want to turn on the LED, which means we are generating output on that pin, and thus the mode of that pin will be output. We would write Input if we were reading the input on that pin.
The second thing is the type of output we are generating on that pin. There are two modes in Arduino programming and those are as follows.
Digital Mode & Analog Mode
We use digital mode to read and write digital output on a specific pin, whereas analog mode is used to read and write the analog output. In our case, we want to be able to perform both of these functions, but we will use digital mode because we only want to toggle the LED and not control the brightness.
For this, we’d use the following code.
pinMode(LED_PIN, OUTPUT)
We’ve defined the pin’s mode here. Pincode is a built-in function with two parameters. The first parameter is the PIN, and the second is the pin’s state (Output or Input)
Now we’ll look at the void loop.
In this function, we write our logic to toggle a specific pin.
To toggle the pin, as previously discussed, we can use the digitalWrite function. The digital write function is also built-in and requires two parameters. The first is the pin’s name, and the second is the pulse state that we want to apply to that pin.
We’ll also need to add a delay function between these two functions because we won’t be able to see the LED blinking if we don’t. This is due to the void setup running 1000 times per second, and if the function is not stopped, the toggling process of the LED will be so fast that we will not be able to see the change in the state of the LED.
So, to stop the loop, we’ll have to use the delay.
So, this is the code we can use to make the Arduino Pro Mini’s onboard LED blink.
You can now copy the following code and paste it into the Arduino board.
Please follow the steps below to upload the code to the Arduino board.
Stepwise Procedure For Uploading The Code To Arduino Pro-Mini Board
- Download and open the Arduino IDE. (You can refer to the booklet to know how to download the Arduino IDE.)
- Copy the following code and paste it in the Editor section
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
- Select the board from the board manager
- Select the com port
- Press CTRL+U on the keyboard to upload the code to the Arduino board.
Congratulations!! The Arduino code has been successfully uploaded to the Arduino board. When the upload is complete, the onboard LED will begin to blink. If this is not the case, please check the wiring and, if the problem persists, please leave your questions in the comments section.
LDR (Light Dependent Resistor)
The light-dependent resistor is nothing more than a resistor. And the value of this resistor varies with the intensity of the light.
You’ve probably seen the stud lights on the streets. LDR is used to detect light in those lights.
Application Of The LDR Sensor
As previously stated, LDR is used in light detection applications. We can apply this feature to a wide range of projects. Some of these applications are listed below. Please look into it.
1. The LDR can be used to detect the intensity of light in a solar cell charging unit. The control unit can rotate the solar panel to generate the most energy based on the readings it receives from the LDR.
2. Light Tracking Robot – This is a very popular example of the use of LDR. You may have seen the light-following robot video on YouTube. These kinds of robots can be created with the help of an LDR sensor.
3. Stud Lights – You’ve probably seen stud lights on the streets. Those lights are used to indicate something. LDRs are used in those lights to detect daylight.
Interfacing LDR With Arduino
The interfacing of LDRs is extremely simple.
Please see the image below to understand how to interface an LDR with an Arduino.
Arduino Code For LDR
int ldr=10;//Set A0(Analog Input) for LDR.
void setup() {
Serial.begin(9600);
}
void loop() {
value=analogRead(ldr);//Reads the Value of LDR(light).
Serial.println("LDR value is :");//Prints the value of LDR to Serial Monitor.
Serial.println(value);
}
I hope you understand how the LDR sensor works with the Arduino. The Interfacing of the Switch will be discussed in the following section of this blog.
Switch
Everyone knows about the switch, in this section, you will learn about the type of switches available in the market.
1) Push-Pull Switches
These switches work just like normal switches. The only difference is that the lever of this switch is horizontal. In addition, this switch has a spring and locking mechanism.
When you press this switch, the spring gets compressed, and the locking mechanism locks the switch. This is how the connection happens.
After that, when you press the switch again, the locking mechanism unlocks the switch, and the connection breaks and the switch acts as an off switch.
2) Rocker Switch –
This type of switch is the same switch used in home appliances. The entire assembly of this switch is enclosed in the box, and a spring attachment button is placed above it.
The remaining function is similar to other types of switches. When you press it, it attaches to the metal contacts, and the connection occurs, and when you press it again, it loses contact with the metal contacts and returns to its initial position.
The switch you are getting with this kit is a push-pull type switch. It has two pins, and the interfacing part of the switch with the Arduino is a really simple task.
In the below image, we have connected the VCC pin to the 5V pin of the Arduino and GND pin to the eight number pin of the Arduino.
Please see the following image to make the connection properly.
Interfacing The Switch With The Arduino Pro Mini
Arduino Code For Switch
In the following code, we have used the state_variable to store the current state of the switch.
You can upload the code to your Arduino and see the output on the serial monitor.
const int buttonPin = 7; // the number of the pushbutton pin
const int ledPin = 4; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
Conclusion – Orange Arduino Pro Mini Starter Kit
In this way, you now understand the fundamentals of all the kit’s components. If you have any questions, please leave them in the comments section.