» Electronics » Arduino »Lego Technic and Arduino truck with Bluetooth control

Lego Technic and Arduino truck with Bluetooth control

I continue modeling from Lego Technic and Arduino. This time I want to share instructions on creating a truck.
Lego Technic and Arduino truck with Bluetooth control


I took part of my design from the assembly instructions for Lego Technic 42049 and Lego Technic 42041. The rest is my improvisation. For control, I will use the Bluetooth module associated with the android device or computer. So we need:
- Lego Technic 42029
- Lego Technic 42033
- Arduino Pro Mini 5v AT Mega 328
- L9110S engine driver
- 1 servo drive SG-90
- Bluetooth module HC-05 or equivalent
- USB-UART for arduino firmware
- Motor gearbox 6v 1: 150 100 rpm
- 2 LEDs
- 2 resistors 150 ohms
- Capacitor 10v 1000uF
- 2 single row combs PLS-40
- Inductor 68mkGn
- 6 NI-Mn 1.2v 1000mA batteries
- Connector dad-mom two pin to wire
- Homutik
- Wires of different colors
- solder
- Rosin
- soldering iron
- Bolts 3x20, nuts and washers for them
- Bolts 3x40
- Bolts 3x60

Step 1 Rear Axle Assembly
Moving forward - backward will be carried out by a gear motor with a 6V motor, a gear ratio of 1: 150 and an idle speed of 100 rpm. You can try another gear ratio, but, in my opinion, this is optimal. The gearbox axis on both sides must be incised in the shape of a cross and put on lego details:

Next, we collect the basis of the rear axle according to the instructions of Lego 42029 part 1, starting from 3 pages to 8 inclusive. And add a few details so that you can install the engine and gearbox.
42029_1.pdf [10.1 Mb] (downloads: 106)
View online file:
42029_2.pdf [14.67 Mb] (downloads: 73)
View online file:






Step 2 Assembling the Front Axle
We assemble the front part of the suspension according to the instructions of Lego 42029 part 1, from page 21 to 23. We take the trapezoid from the second part of Lego from page 6 to 11. Servo SG-90 is well suited for turning the wheels. To fix it on our model, it is necessary to carefully drill, so as not to touch the internal parts of the servo, a through hole with a diameter of 3.2 mm or just cut it with a stationery knife. And also cut off the protruding parts (“wings” for fastening). We insert a bolt into the hole made and fix it with nuts. On the servo shaft we put on a lever with a screwed part from lego:







Step 3 Assembling the base and cab
We connect both bridges as shown in the photo:

We assemble the cabin according to the instructions of Lego 42041. Starting from pages 39 to 47 of the first part. Further from page 5 to 28 of the second part. As well as the bumper on pages 38 to 43 of the second part of the instructions.
42041_1.pdf [5.6 Mb] (downloads: 127)
View online file:
42041_2.pdf [7.39 Mb] (downloads: 119)
View online file:




42041_1.pdf [5.6 Mb] (downloads: 127)
View online file:
42041_2.pdf [7.39 Mb] (downloads: 119)
View online file:


Step 4 Electrics
For control, we will use the Arduino Pro Mini and the Bluetooth module. The Pro Mini can be replaced with any other Arduino board. I chose the Pro Mini, so it is the smallest. The motor driver is needed to connect the motor.

Connection of all components with Dupont mother-to-mother wires. Power - 6 NI-Mn 1.2v 1000mA batteries connected in series. A capacitor of any low power, an inductor also you will find, you need to stabilize the power of the microcontroller. The anodes of the two LEDs are connected to 4 pin arduino, the cathodes to GND. Resistors are selected for the LEDs used. For convenience, reel the batteries with tape.

We glue it all on a double-sided tape on the basis of:

We place our electrician between the wheels and close:

Add a couple of strokes:



Step 5 Bluetooth Setup
The most affordable Bluetooth modules today are the HC-05 and HC-06. They are abundant in Chinese online stores. The differences between them are that the first can work both in master mode (slave) and in slave mode (master). The second is a purely slave device. In other words, HC-06 cannot detect a paired device and establish a connection with it, it can only obey the master.

Brief characteristics of the modules:
- Bluetooth chip - BC417143 manufactured by
- communication protocol - Bluetooth Specification v2.0 + EDR;
- radius of action - up to 10 meters (power level 2);
- Compatible with all Bluetooth adapters that support SPP;
- The amount of flash-memory (for storing firmware and settings) - 8 Mbit;
- the frequency of the radio signal - 2.40 .. 2.48 GHz;
- host interface - USB 1.1 / 2.0 or UART;
- power consumption - the current during communication is 30-40 mA. The average current value is about 25 mA. After the connection is established, the consumed current is 8 mA. There is no sleep mode.

Usually, modules are sold as two boards soldered together. The smaller one is a factory module, widely used in various electronic devices. Large - a special breadboard for DIY.
This is what the HC-05 and HC-06 DIY modules look like:

In principle, you can use any module you like. A module without a breadboard costs less, but then you will have to take care of the 3.3 V power supply for the module and torment yourself by soldering wires to the module. I chose the optimal, in my opinion, in the price / functional ratio HC-06.

We connect as follows:
Arduino Pro Mini - Bluetooth
D7 - RX
D8 - TX
5V - VCC
GND –GND
For proper operation, the module must be configured. We will configure AT commands entered into the terminal window. I give an example of setting up the HC-05 module. If you have a different setting may be different. In order for our module to receive commands, first we flash the Arduino with the following firmware:
bluetooth_send_at.rar [857 b] (downloads: 73)

In this case, Arduino act as a bridge between computers and the module. In the firmware, I use the SoftwareSerial library. At high speeds, it works unstably. If you want high speed, you can connect the module directly to the Arduino RX and TX contacts and rewrite the firmware. But in my case, we will work with the module at a speed of 9600. So after the firmware, open the terminal and enter:
“AT” (without quotes) the answer “OK” should come (it means everything is connected correctly and the module is working)
“AT + BAUD96000” (without the quotes) the answer “OK9600” should come.
If you have the right answer, go to the next step.

Step 7 Firmware
To write the firmware and the firmware itself, I use the Arduino IDE. The current version for today is 1.8. Actually firmware:
grusovik.rar [956 b] (downloads: 75)


Step 8 Set up your phone.
On an Android phone, you need to install a program to control the robot via Bluetooth. There are a lot of them. You can enter “Bluetooth Arduino” in Google play and choose to your taste. I liked the BT Controller. Download and install on your Android phone or tablet. Next, through the Android settings, you need to establish a connection with our module. The password for the connection is “1234” or “0000”. Next, configure the program for the appropriate commands. The list is below.

Step 9 Computer Setup (if necessary)
If necessary, or just convenience for control, you can use a computer or laptop. To do this, the computer must have Bluetooth. We establish communication with our module through the controls on the computer. Next, we need a terminal to send commands. Any convenient for you.Having recorded the firmware, control is performed by the following buttons (commands):
W - forward
S - back
A - left
D - right
F - stop
G - steering wheel
K - headlights
L - headlight off

Constantly entering commands is inconvenient, so I recommend using the program to send commands. I am using Z-Controller. In the program, select the port (com port through which the connection is made) and configure the keys for the commands. Set up idle and intuitive.
bluetooth-pc.rar [49.07 Kb] (downloads: 63)

Lego Techic and Arduino
Total Voters: 15
4
4
4

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose

We advise you to read:

Hand it for the smartphone ...