Views:5 Author:Site Editor Publish Time: 2021-06-25 Origin:Site
Since the last made a integrates motor driven the smallest board, I found a cheap and function in the market now and no more remote control, and hence produced yourself of the idea of painting a piece, and the remote control can also be combined with my motor driver board, such a scheme of remote control have, what do you want to be when remote control cars, remote control boat,For things like robots and remote-controlled airplanes, they can be used directly.It will be much more convenient, and the portability and stability will be much better, so this time I designed a remote control board, the volume is very small, the whole layout is only 9.6mm*4.6mm, can be called on the palm remote control, and many common functions.
The first part
First of all, the function of the whole remote control is planned. First, the goal is set, that is, what function my finished product needs to achieve, so that it is convenient to ensure the specificity of our goal in the design and the finished product can be checked according to my goal list to see whether all my target functions are up to standard.
1. Single chip microcomputer selection
I still choose ATmega328 for the single chip, in fact, ATmega8 can also be chosen, and the price is more advantageous, and the pin parts of the two chips are the same, so the single chip can be replaced later, without changing the circuit structure, because I have not used ATmega8,So consider using Atmega328 implementation, the following is Atmega328 pin diagram.
2. Wireless communication module
There are many versions of nRF24L01 wireless module in a certain Bao, I use this one which uses DIP2*4 pin output. It is said that there is also a board loaded with power amplifier, the interface is compatible, so if you want to increase the remote control distance in the later period, you can use the module with power amplifier.
As for the circuit to power it, I still use the MIC5205 scheme. I have used it in many projects. It is small in size (in the package of SOT23-5) and the output current is enough (150mA).However, we pay attention to its maximum withstand voltage when choosing the capacitor. Generally, businesses will mark in the parameters. I choose the 10UF capacitor with voltage resistance of 10V.
3. The rocker
First of all, as a remote control, the proportional control joystick must be included, so that we can control some proportional channels (such as motor speed, light brightness, steering gear rotation Angle and anything that needs to be continuously changed).Referring to the common design on the market, the design of two omnidirectional joystick is a better choice (similar to the joystick on the PS2 handle) About the principle of joystick, I will briefly introduce:
In fact, the essence of the joystick is to make the joystick's rotating shaft connected to a potentiometer. The potentiometer is used to position the joystick, so that we can calculate the position of the joystick by reading the voltage value of the potentiometer.If it is omnidirectional joystick, there are generally two potentiometers to locate the position of the joystick on the X axis and Y axis, so that the ADC of the single chip microcomputer can read the voltage, so as to know the position of the joystick.
Then each joystick has two axes of motion, and two joysticks have four axes of motion, so I can use two joysticks to control the four proportional channels.
Obviously, the control of the four proportional channels is not enough. Some projects also need the control of switching quantities (such as light switching and mode switching), so I designed two additional key switches to control some switching quantities.
As for the detection circuit of the key switch, I directly connected the two pins of the key switch to GND and the single chip pin respectively. The reason why the pull-up resistor is not set is that I will use the pull-up resistor inside the single chip, so there is no need to connect the pull-up resistor outside, which also saves the layout space.
For pin connection is need particularly note, must and MCU external interrupt pin connection, explain the reasons here: if you don't use the interrupt pin to detect the state of the button switch, because the key operating time is short, it is easy to cause microcontroller when run other programs to miss key testing program, this button press cannot be detected.If the key is connected to the interrupt pin, no matter what program the microcontroller is executing, it can stop executing the current program in the first time and enter the interrupt service program to execute the key instruction.For ATMGEA328, there are two external interrupt pins, so I connect these two keys to the two pins.
5. Boost circuit
The circuit that supplies power to ATmega328 this time is the booster circuit of E50D scheme, the maximum output current is about 800mA, enough for use.A reminder here, because the E50D operating frequency is around 300KHz, so you should pay attention to the isolation of low-frequency lines when wiring.
6. The power supply
As for the power supply of the remote control, I did not hesitate to choose the 18650 lithium battery. This kind of battery is the most common one in the market (many batteries will be used in the charging bank). Besides, it has low internal resistance, regular body shape and convenient wiring and fixing.Which specific brand of 18650 lithium effect is good, it is said that Panasonic's battery is good, but the price is moving.So I used the Shenhuo 18650, first try, if not for other homes.
7. Charging circuit
Charging chip, for a lithium battery scheme is still relatively uniform, a treasure on the search 18650 charging board a lot of search, but the use of charging IC, basically TP4056.Not only is it cheap and works well, the only problem is that the heat is a little big...
I put out my circuit diagram, if you want to design charging circuit can also use for reference.
R2 is connected to the Prog pin to set the charging current. The setting of the charging current can be set according to the formula: I=1/R*1200. CHRG is the charging state indicating pin.The charging port uses Micro USB, so you can charge with your phone charger.
8. Voltage detection
I have also thought about the battery protection circuit, but I think it is a remote control. What if the protection board disconnects the output when the battery is low?(The protection circuit will disconnect the output voltage when the battery is low.) Wouldn't that cause a loss of control?So instead of using the protection circuit, I used the voltage detection circuit, so that when the battery voltage is low, I can keep the whole system running for a period of time without immediately losing power, so as to remind the user to replace the battery.
The voltage detection circuit is very simple. It is directly connected to the A0 pin of the ATmega328 and uses the ADC to sample the voltage value.As for the alarm circuit, I continue to use the alarm circuit of the minimum board designed last time, and use 555 to form a monostable trigger, which can control the intermittent buzzer.
9.USB to TTL circuit
Because of the use of micro USB interface, simply add a USB to TTL circuit, so that programming and charging can share the same interface, it is much more convenient to use.
As for the selection of TTL chip, it is natural to consider the CH340 series chip, the use of a wide range of and relatively stable, in the CH340 product line there are many different models, the use of more is CH340G and CH340C model, but because they use the SOIC16 package, the volume is large,Therefore, I adopted CH340E, the smallest one of CH340. Its peripheral circuit is simple, which is very suitable for my project.
TNOW indicates that the serial port is sending and the high level is valid, so I connected an LED light to indicate the status of the serial port. This design is also common on some USB to TTL modules.
10. Reserved interface
Since there aren't too many external devices involved in the remote, this time I only reserved a few ports.Because atmega328 needs to burn the bootloader, so I reserved a write-interface to facilitate later write-in.I have reserved the I2C interface, mainly for the convenience of connecting to the LED display screen in the future
The second part
Schematic diagram is drawn after the export drawing PCB board, because to hand operation, so for the shape is still very important, I drew a rectangular border, and round the corners, so that it will not scratch the hand.
After more than an hour of wiring and placement of components, I finished the design:
At the same time, I also reserved four mounting holes on the board, so that it is convenient to fix the remote control in the future (such as adding a shell).
At this point, the design of the whole board is completed. I have sent the manufacturer to make the board, and the board is expected to arrive this week.In the next chapter I will solder the boards, test them, and make the necessary improvements.If you have any good suggestions, please leave them in the comments below. Thank you.