How about making an arduino radio control, based on nRF24L01+? In any case, this is what I suggest you do here, following the tutorial on the nRF24L01 that I previously wrote for you.
But before going further, know that this RC transmitter is the part 1/2 of a small radio controlled car project. That being said, even if you are not interested in the world of scale models, know that you can learn a lot here, including how to send personalized data by radio waves. Moreover, you are free to adapt this assembly, for your future and wireless applications!
On the other hand, keep in mind that this project is intended to be educational above all. This is why it will be simple, fun, and didactic. It is mainly intended for beginners in electronics, who wish to take their first steps with an RF transmitter/receiver, connected to an Arduino. Thus, they will see a concrete application of the nRF24L01+, and a way of doing things (sending “structured” data, here). Of course, whether you are a beginner or not, do not hesitate to ask your questions and comments at the bottom of the page, if necessary! I will try to answer them as precisely as possible, within the limits of my skills and the time I have, of course!
Before going any further, I have listed here all the necessary components, if you wish to reproduce this assembly identically. By the way, for those who don't know where to find some of these components, I've added links to help you find them easily on the net. Of course, you are free to buy them wherever you want!
Just to see it a little clearer, here is the functional diagram of this arduino nRF24L01 radio control:
In fact, the Arduino will take care of almost everything! Because overall, it will:
Monitoring the voltage of each li-ion battery, in order to alert the user visually and audibly, in the event of a low battery (to avoid deep discharges, which can damage lithium ion batteries)
Reading the position of the joystick (of its 2 integrated potentiometers, more precisely, one for the X axis and the other for the Y axis)
The transformation (formatting) of these values, so that they correspond to clear and precise "orders": up, down, left, right, and of what intensity
Sending this data to the nRF24 module, for transmission via radio waves
Electronic diagram
Now, let's see the electronic diagram of our arduino radio control project, just to make it all happen!
Arduino radio control electronic diagram with nrf24l01+ and piloting joystick, RC transmitter project for short-range radio model
As you will see, I have divided this diagram into several blocks, in order to facilitate understanding. So you will see:
A power supply part: made up of lithium ion batteries, and the 3.3 volt voltage regulator
A voltage level sensor part: consisting of two resistive divider bridges (in order to monitor each battery individually, so that it does not fall below 3 volts)
A control part: simply provided by our Arduino Pro Mini (3.3 V model and not 5V, be careful)
A radio transmission part: entrusted to the nRF24L01+ module
An alarm part: allowing to indicate visually and/or audibly, that the batteries are weak, or simply too discharged
A control part: essentially consisting of a 2-axis joystick (X and Y), of the PS2 type
For now, don't worry if some of these blocks don't seem clear to you. Because we are now going to detail them one by one, without further ado!
Explanations of operation, hardware part
Now, we will examine each block of the previous electronic diagram in detail, so that you can understand each part of it, and why I made this or that component choice for this project. So forward!
The Arduino Pro Mini 3V3
You will certainly ask yourself: but why did you take an Arduino Pro Mini, when a simple Arduino Nano would have done the trick? In fact, the reason is simple: it is to have maximum autonomy, at the level of the batteries. Because Arduinos equipped with a USB port consume a lot of electricity when idle, even if there is no data exchanged via USB. In fact, this comes from their USB/serial converters (CH340, CP2102, etc.), which are permanently powered, and consume "quite a lot" of no-load current. Of course, for projects powered by a power socket or USB socket, this is not a problem. But when running on a battery, it is better to aim for energy saving! Hence the choice of the Arduino Pro Mini, which does not have an integrated USB converter!
Note that this choice will complicate a bit
programming, if you are not used to it. Because you will have to use a small “external” USB/serial converter (which costs only a few euros, don’t worry), and make some specific settings in the Arduino IDE. But in the end, believe me, there is nothing really rocket science, and above all, we gain frankly in battery autonomy, by proceeding this way!
In addition to having chosen an Arduino Pro Mini, I also chose to go with a 3.3 volt model, and not 5V. In fact, there is also a simple explanation here: as we are going to be powered by two lithium ion batteries, we will not have enough voltage to last long, operating at 5V. Indeed, each li-ion battery can go down to 3 volts (we will avoid discharging them more than that, in order to avoid reducing their lifespan too quickly). However, as we have here 2 lithium-ion batteries, this means that the voltage can drop to 2 x 3V, or 6 volts. And since most 5V voltage regulators require 2 volts more at the input (i.e. 7 volts) to work well, you cannot simply "manufacture" 5V from a source outputting 6 volts. So, I ended up using an Arduino operating exclusively at 3.3 volts, to take full advantage of the potential of lithium ion batteries.
Now that we have seen together the technical reasons for this choice, let's see what our Arduino will have to do:
Monitor the voltage levels of each battery, on its analog inputs A0 and A1
Read the voltages at the joystick terminals (X axis, Y axis, and Z push button), on analog inputs A2 and A3, and digital input D5
Allow the emission of light signals, via two LEDs connected to the digital outputs D2 and D3
Allow the emission of a sound signal, via a mini PCB speaker, powered on the digital output D6 (in PWM)
Activate/control the NRF24L01+ radio module, via digital outputs D7 and D8
Send data to the nRF24 module, via its SPI port (outputs D11, D12, and D13)
Note: The Arduino Pro Mini includes a row of pins, "on its top", allowing it to be programmed via PC. On the other hand, this requires the use of an “intermediate” USB/TTL converter, between the PC and it. But don't worry: it's very easy to find on the market, and for cheap! On the programming side with the Arduino IDE, you will see that it does not change much (only a few parameters to modify). But I admit, it can be a bit confusing at first.
Power supply (lithium-ion 18650 batteries)
The power supply of our arduino radio control will be entrusted to 2 lithium ion 18650 batteries put in series, making 3.7 volts each, nominally (3V min / 4.2V max). An anti-return diode (D1) will protect our assembly from the main risks of reversing the direction of the battery. And the fuse (F1), meanwhile, will provide fast and effective protection against any short circuit or current overload.
A small slide switch, mounted on the PCB, will cut off this power supply when the assembly is no longer in use (to save energy as much as possible). Finally, a linear regulator delivering 3.3 volts will ensure a suitable voltage to power our microcontroller (ATmega328), the radio transmitter/receiver (nRF24),… as well as all the rest of the assembly, for that matter!
Note: on the final assembly, you will see that I used a 3.3 volt regulator in CMS format (surface mounting). This is due to the fact that I had “quite a lot” on hand, and that this may be a good opportunity for you to learn about soldering surface-mounted components! Because the case of this regulator does not have many pins, and is not that small, in the end! It will therefore be an excellent exercise for you (to solder this one and only SMD component), if you are new to electronics
Cell voltage level sensors (voltage divider bridges)
In order to be able to measure voltages of up to 8.4 volts (i.e. the 2 li-ion batteries connected in series, charged to a maximum of 4.2V), it is necessary to go through a voltage lowering device. Because our Arduino Pro Mini operates at 3.3 volts, and will not be able to read voltages higher than it, on its analog inputs.
To do this, I chose to make resistive bridges dividing the voltage approximately by 3 (with an in-line resistor of 22 k-ohm, and a pulldown resistor of 10 k-ohm). Applied to our assembly, here is what it gives (if we take the A0 input of the microcontroller, for example):
VA0 = Vmid * R2 / (R1 + R2)
hence VA0 = Vmid * 10000 / (10000+22000)
hence VA0 = 0.3125 * Vmid
Similarly for the equation of VA1, giving the equation: VA1 = 0.3125 * Vup.
Note that, as you have seen on the electronic diagram presented a little above, the voltages:
Vmid corresponds to the voltage of the 1st Li-ion battery
Vup corresponds to the voltage
on of the 2 li-ion batteries placed in series (we can therefore deduce the voltage of the 2nd battery, by subtracting this value from the voltage of the 1st battery)
We can easily check if our equations are correct, by taking a few values (here, for the 1st 18650 lithium-ion battery, whose voltage can range from 0 to 4.2 volts, if fully charged):
VMID VOLTAGE
How about making an arduino radio control, based on nRF24L01+? In any case, this is what I suggest you do here, following the tutorial on the nRF24L01 that I previously wrote for you.
But before going further, know that this RC transmitter is the part 1/2 of a small radio controlled car project. That being said, even if you are not interested in the world of scale models, know that you can learn a lot here, including how to send personalized data by radio waves. Moreover, you are free to adapt this assembly, for your future and wireless applications!
On the other hand, keep in mind that this project is intended to be educational above all. This is why it will be simple, fun, and didactic. It is mainly intended for beginners in electronics, who wish to take their first steps with an RF transmitter/receiver, connected to an Arduino. Thus, they will see a concrete application of the nRF24L01+, and a way of doing things (sending “structured” data, here). Of course, whether you are a beginner or not, do not hesitate to ask your questions and comments at the bottom of the page, if necessary! I will try to answer them as precisely as possible, within the limits of my skills and the time I have, of course!
Before going any further, I have listed here all the necessary components, if you wish to reproduce this assembly identically. By the way, for those who don't know where to find some of these components, I've added links to help you find them easily on the net. Of course, you are free to buy them wherever you want!
Just to see it a little clearer, here is the functional diagram of this arduino nRF24L01 radio control:
In fact, the Arduino will take care of almost everything! Because overall, it will:
Monitoring the voltage of each li-ion battery, in order to alert the user visually and audibly, in the event of a low battery (to avoid deep discharges, which can damage lithium ion batteries)
Reading the position of the joystick (of its 2 integrated potentiometers, more precisely, one for the X axis and the other for the Y axis)
The transformation (formatting) of these values, so that they correspond to clear and precise "orders": up, down, left, right, and of what intensity
Sending this data to the nRF24 module, for transmission via radio waves
Electronic diagram
Now, let's see the electronic diagram of our arduino radio control project, just to make it all happen!
Arduino radio control electronic diagram with nrf24l01+ and piloting joystick, RC transmitter project for short-range radio model
As you will see, I have divided this diagram into several blocks, in order to facilitate understanding. So you will see:
A power supply part: made up of lithium ion batteries, and the 3.3 volt voltage regulator
A voltage level sensor part: consisting of two resistive divider bridges (in order to monitor each battery individually, so that it does not fall below 3 volts)
A control part: simply provided by our Arduino Pro Mini (3.3 V model and not 5V, be careful)
A radio transmission part: entrusted to the nRF24L01+ module
An alarm part: allowing to indicate visually and/or audibly, that the batteries are weak, or simply too discharged
A control part: essentially consisting of a 2-axis joystick (X and Y), of the PS2 type
For now, don't worry if some of these blocks don't seem clear to you. Because we are now going to detail them one by one, without further ado!
Explanations of operation, hardware part
Now, we will examine each block of the previous electronic diagram in detail, so that you can understand each part of it, and why I made this or that component choice for this project. So forward!
The Arduino Pro Mini 3V3
You will certainly ask yourself: but why did you take an Arduino Pro Mini, when a simple Arduino Nano would have done the trick? In fact, the reason is simple: it is to have maximum autonomy, at the level of the batteries. Because Arduinos equipped with a USB port consume a lot of electricity when idle, even if there is no data exchanged via USB. In fact, this comes from their USB/serial converters (CH340, CP2102, etc.), which are permanently powered, and consume "quite a lot" of no-load current. Of course, for projects powered by a power socket or USB socket, this is not a problem. But when running on a battery, it is better to aim for energy saving! Hence the choice of the Arduino Pro Mini, which does not have an integrated USB converter!
Note that this choice will complicate a bit
programming, if you are not used to it. Because you will have to use a small “external” USB/serial converter (which costs only a few euros, don’t worry), and make some specific settings in the Arduino IDE. But in the end, believe me, there is nothing really rocket science, and above all, we gain frankly in battery autonomy, by proceeding this way!
In addition to having chosen an Arduino Pro Mini, I also chose to go with a 3.3 volt model, and not 5V. In fact, there is also a simple explanation here: as we are going to be powered by two lithium ion batteries, we will not have enough voltage to last long, operating at 5V. Indeed, each li-ion battery can go down to 3 volts (we will avoid discharging them more than that, in order to avoid reducing their lifespan too quickly). However, as we have here 2 lithium-ion batteries, this means that the voltage can drop to 2 x 3V, or 6 volts. And since most 5V voltage regulators require 2 volts more at the input (i.e. 7 volts) to work well, you cannot simply "manufacture" 5V from a source outputting 6 volts. So, I ended up using an Arduino operating exclusively at 3.3 volts, to take full advantage of the potential of lithium ion batteries.
Now that we have seen together the technical reasons for this choice, let's see what our Arduino will have to do:
Monitor the voltage levels of each battery, on its analog inputs A0 and A1
Read the voltages at the joystick terminals (X axis, Y axis, and Z push button), on analog inputs A2 and A3, and digital input D5
Allow the emission of light signals, via two LEDs connected to the digital outputs D2 and D3
Allow the emission of a sound signal, via a mini PCB speaker, powered on the digital output D6 (in PWM)
Activate/control the NRF24L01+ radio module, via digital outputs D7 and D8
Send data to the nRF24 module, via its SPI port (outputs D11, D12, and D13)
Note: The Arduino Pro Mini includes a row of pins, "on its top", allowing it to be programmed via PC. On the other hand, this requires the use of an “intermediate” USB/TTL converter, between the PC and it. But don't worry: it's very easy to find on the market, and for cheap! On the programming side with the Arduino IDE, you will see that it does not change much (only a few parameters to modify). But I admit, it can be a bit confusing at first.
Power supply (lithium-ion 18650 batteries)
The power supply of our arduino radio control will be entrusted to 2 lithium ion 18650 batteries put in series, making 3.7 volts each, nominally (3V min / 4.2V max). An anti-return diode (D1) will protect our assembly from the main risks of reversing the direction of the battery. And the fuse (F1), meanwhile, will provide fast and effective protection against any short circuit or current overload.
A small slide switch, mounted on the PCB, will cut off this power supply when the assembly is no longer in use (to save energy as much as possible). Finally, a linear regulator delivering 3.3 volts will ensure a suitable voltage to power our microcontroller (ATmega328), the radio transmitter/receiver (nRF24),… as well as all the rest of the assembly, for that matter!
Note: on the final assembly, you will see that I used a 3.3 volt regulator in CMS format (surface mounting). This is due to the fact that I had “quite a lot” on hand, and that this may be a good opportunity for you to learn about soldering surface-mounted components! Because the case of this regulator does not have many pins, and is not that small, in the end! It will therefore be an excellent exercise for you (to solder this one and only SMD component), if you are new to electronics
Cell voltage level sensors (voltage divider bridges)
In order to be able to measure voltages of up to 8.4 volts (i.e. the 2 li-ion batteries connected in series, charged to a maximum of 4.2V), it is necessary to go through a voltage lowering device. Because our Arduino Pro Mini operates at 3.3 volts, and will not be able to read voltages higher than it, on its analog inputs.
To do this, I chose to make resistive bridges dividing the voltage approximately by 3 (with an in-line resistor of 22 k-ohm, and a pulldown resistor of 10 k-ohm). Applied to our assembly, here is what it gives (if we take the A0 input of the microcontroller, for example):
VA0 = Vmid * R2 / (R1 + R2)
hence VA0 = Vmid * 10000 / (10000+22000)
hence VA0 = 0.3125 * Vmid
Similarly for the equation of VA1, giving the equation: VA1 = 0.3125 * Vup.
Note that, as you have seen on the electronic diagram presented a little above, the voltages:
Vmid corresponds to the voltage of the 1st Li-ion battery
Vup corresponds to the voltage
on of the 2 li-ion batteries placed in series (we can therefore deduce the voltage of the 2nd battery, by subtracting this value from the voltage of the 1st battery)
We can easily check if our equations are correct, by taking a few values (here, for the 1st 18650 lithium-ion battery, whose voltage can range from 0 to 4.2 volts, if fully charged):
VMID VOLTAGE
No comments:
Post a Comment