[Diao Ye learns programming] Arduino hands-on (194)---makeblock mbot main control board

The reference to 37 sensors and modules has been widely circulated on the Internet. In fact, there must be more than 37 sensor modules compatible with Arduino. In view of the fact that I have accumulated some sensor and actuator modules on hand, in accordance with the concept of true knowledge (must be hands-on), for the purpose of learning and communication, here I am going to try and do more experiments one by one. Whether it is successful or not, it will be recorded ——Small progress or unsolvable problems, I hope to be able to throw bricks and spark jade.

[Arduino] 168 kinds of sensor module series experiments (data code + simulation programming + graphics programming)
experiment one hundred and ninety-four: mbot main control board makeblock mCore V1.5 development board RJ25 interface robot compatible with Arduino

insert image description here
insert image description here

mBot, this industrial-grade main control board with a sense of technology, supports building block computer programming and Arduino programming. In other words, it evolved from Arduino. The UNOs in the Arduino system are the same, so they have similar functions and interfaces in some programs.

insert image description here
1. The minimum system of atmega328 The
commonly used minimum system is composed of a clock circuit (crystal oscillator circuit), a reset circuit and a power supply circuit, as shown in the figure below, in which the crystal oscillator uses a 16M crystal oscillator, the reset circuit is active at low level, powered by 5V voltage, and at the same time Lead out each control pin in the form of a network label, and then connect it to each functional circuit module, among which D13/SCK is connected to an LED light, because MISO, MOSI and SCK form the SPI interface, and SCK provides the clock, so This Led should display the working status of the SPI.

insert image description here

Clock circuit
A 1M ohm resistor is connected in parallel to the crystal oscillator. After consulting the information, it is found that its function is to reduce the Q value, increase the damping, and shorten the start-up time.
insert image description here

2.
The voltage on the power supply circuit mBot can be provided in three ways, as shown in the figure below, one is the USB power supply mode (VBUS in the figure), which is mainly used for debugging programs, because it can provide both voltage and communication , such as downloading programs, etc.; one is powered by a battery, the battery is introduced by P1, and the other is provided by a DC adapter power supply, and when the latter two are powered, only one of them can work through the function of the CMOS triode .

insert image description here
Regardless of the power supply method, the switch S1 is used to control the voltage on and off. When S1 is closed, there are two voltage outputs, one is connected to the drive part of the motor for power supply, and the other is converted into 5V voltage by the TP3603 chip. The entire system is powered. It is worth mentioning that the converted 5V voltage is further protected by Schottky diodes, TVS diodes and capacitors, which greatly increases the stability of the system voltage, and finally indicates the working status of the voltage through an LED light.

TP3605 is a 1MHz fixed frequency CC (constant current) mode PWM step-up DC-DC converter launched by TPmicro (TapowerSemiconductor Inc.). The chip integrates a 2.1A/200mΩ main switch, a single lithium battery can output a load current of 5V up to 1A, and the maximum output voltage can reach 12V. It has integrated the upper and lower bridge MOS internally, and the output voltage can be obtained only by adding an output inductor and a rectifier diode externally, and the efficiency is as high as 94%. Current mode control provides fast transient response and periodic peak current limit capability. TP3605 has protection mechanisms such as over-temperature protection, shutdown protection, under-voltage protection, and over-current protection, which increase the stability of the system to ensure the safety of chip work. TP3605 has high conversion efficiency, which can reach more than 94%. Especially in shutdown mode, it only needs less than 1uA of operating current, which saves more power under the same conditions, making it possible to obtain longer standby time in the application field of handheld products.

charging circuit

insert image description here
TP4056 is a lithium battery constant voltage linear charging management IC, the charging voltage is fixed at 4.2V.
Pin TEMP1: Battery temperature detection input, connected to the output terminal of the NTC sensor of the battery, if the temperature is too low or too high, the voltage output of this pin will be abnormal, and charging will be suspended. Of course, this is grounded to GND, so there is no such function .
Pin PROG2: Charging current detection terminal, generally a resistor R is connected in series to monitor the current I
pin CE: Enable terminal, high level enable
pin CHRG: Charging status indication, internal pull-down low level during charging, otherwise high resistance State
pin STDBY: charging completion indication, internal pull-down, otherwise high-impedance state
pin BAT: battery connection terminal

Power Control Management
TP3605 has over-temperature protection, shutdown protection, under-voltage protection, over-current protection and other protection mechanisms, which increase the stability of the system to ensure the safety of the chip work. TP3605 has high conversion efficiency, which can reach more than 94%. Especially in shutdown mode, it only needs less than 1uA of operating current, which saves more power under the same conditions, making it possible to obtain longer standby time in the application field of handheld products.

insert image description here
3. USB&serial port circuit
The interface circuit of USB, as shown in the figure below, first provides 5V voltage from the USB interface, and introduces it into the power supply circuit through VBUS. The TTL serial ports D0/RXD and D1/TXD on the computer are converted into USB interfaces, and at the same time D0/RXD and D1/TXD are connected to the Bluetooth module through P5 for data communication between the main control chip and Bluetooth, USB and Bluetooth. In addition, the Bluetooth module and the main control chip communicate with the P4 interface and its circuit, and share the reset function.

insert image description here
CH340 is a USB bus adapter chip, which realizes USB to serial port, USB to IrDA infrared or USB to printer port. In the serial port mode, CH340 provides common modem communication signals, which are used to expand the asynchronous serial port for the computer, or directly upgrade ordinary serial port devices to the USB bus; in the infrared mode, the CH340 plus an infrared transceiver can form a USB infrared adapter. Realize SIR infrared communication. It has: full-speed USB device interface, compatible with USB v2.0, peripheral components only need crystals and capacitors; emulated standard serial port, used to upgrade the original serial port peripherals, or add additional serial ports through USB; serial port under Windows operating system on the computer side The application program is fully compatible without modification; hardware full-duplex serial port, built-in transceiver buffer, supports communication baud rate 50bps~2Mbps; supports commonly used MODEM contact signals RTS, DTR, DCD, RI, DSR, CTS; Conversion device, provide RS232, rs485, RS422 and other interfaces; support IrDA standard SIR infrared communication, support baud rate 2400bps to 115200bps.

USB to serial port circuit

insert image description here
CH340G also needs an M start-up circuit, power supply 5V (3.3V voltage is also available, but the V3 pin must be connected to VCC and an external 3.3V power supply must be introduced, and the external connection circuit must not exceed 3.3V), the chip has a built-in The power-on-reset circuit is established.

4. The motor drive circuit
controls the two drive circuits on the mBot. As shown in the figure below, DIR2_D4+ and DIR1_D7 derived from the control chip ATMega328 control the direction of rotation, and PWM1_D6 and PWM2_D5 control the speed of rotation. These four pins are respectively connected to the driver On the chip TB6612, after the processing of TB6612, it is converted into real control signals M1+, M1- and M2+, M2- connected to the motor through P2 and P3 to control the rotation of the circuit.

insert image description here

TB6612 is a DC motor drive device produced by Toshiba Semiconductor Corporation. It has a high-current MOSFET-H bridge structure, dual-channel circuit output, each channel outputs a continuous drive current of up to 1.2 A, and the starting peak current reaches 2A/3.2 A (continuous pulse/single pulse), 4 motor control modes: forward/reverse/brake/stop, PWM support frequency up to 100 kHz, on-chip low voltage detection circuit and thermal shutdown protection circuit. Due to its MOSFET based H-bridge integrated circuit, it is more efficient than transistor H-bridge drivers. Compared with the commonly used L298N's heat consumption and peripheral diode freewheeling circuit, it does not need an additional heat sink, and the peripheral circuit is simple. It can directly drive the motor only by connecting an external power filter capacitor, which is beneficial to reduce the size of the system.

Driver IC TB6612, high-current dual-channel circuit output, can drive 2 motors at the same time! Each channel outputs up to 1.2 A continuous drive current, starting peak current up to 2A/3.2 A (continuous pulse/single pulse); 4 motor control modes: forward/reverse/braking/stop, PWM support frequency up to 100 KHZ ;Standby state; On-chip low-voltage detection circuit and thermal shutdown protection circuit; We know that to control a DC motor, generally 3 IO pins are required, one controls the output PWM, and the other 2 controls the forward and reverse mCore, and 2 motor controls Only 4 IO pins are used, which really saves 2 IO resources!

Under the analysis, the triode 9013 is NPN type. When DIR2_D4+ is high level, the triode is turned on, and DIR2_D4- is grounded at low level. When DIR2_D4+ is low level, the triode is cut off. DIR2_D4- is connected to +5V series resistance, which is high level. Likewise, DIR2_D7+ is the same. This design saves resource IO, but it cannot be braked by simultaneous high or simultaneous low, but can only be braked by controlling the PWM speed control.

5. Onboard sensor circuit

insert image description here
Button circuit
The button circuit is very simple, press the low level and play the high level.

6. RGB control circuit, and photoresistor control circuit

Photosensitive sensor circuit
The circuit of the photosensitive sensor is also very simple. The main understanding is that the photoresistor, as the light intensity increases, its resistance value will gradually decrease. This characteristic is reflected in the circuit, that is, the stronger the light, the greater the voltage at the A6 terminal.

insert image description here
RGB three-color light circuit
The RGB three-color light of mBot is different from the previous three-color light. It uses an intelligent externally controlled LED light source that integrates a control circuit and a light-emitting circuit, that is, WS1812B. The main thing is to understand that when cascading, the signal is reduced by 24 bits every time a pixel is transmitted. ws2812B is an intelligent external control LED light source integrating control circuit and light emitting circuit. Its appearance is the same as a 5050LED lamp bead, and each element is a pixel. The pixel contains an intelligent digital interface data latch signal shaping and amplifying drive circuit, as well as a high-precision internal oscillator and a programmable constant current control part, which effectively ensures that the color of the pixel light is highly consistent. The data protocol adopts the single-line return-to-zero code communication method. After the pixel is powered on and reset, the DIN terminal receives the data transmitted from the controller. The 24bit data sent first is extracted by the first pixel and sent to the inside of the pixel. The remaining data is reshaped and amplified by the internal shaping processing circuit, and then forwarded and output to the next cascaded pixel through the DO port. Every time a pixel is transmitted, the signal is reduced by 24 bits. Pixels adopt automatic shaping and forwarding technology, so that the number of cascaded pixels is not limited by signal transmission, but only limited by signal transmission speed requirements. The specific working principle can be found in its data sheet.

Guess you like

Origin blog.csdn.net/weixin_41659040/article/details/132139215