background image

 

20 

 

                           

                                                           

 

    (a) When the button is NOT PRESSED            (b) When the button is PRESSED 

Ultrasonic Module HC-SR04 Distance Sensor 

 

The  ultrasonic  ranging  module  HC-SR04  provides  2cm-700cm  non-contact  measurement 
function, and the ranging accuracy can reach 3mm. Stable signal can be ensured within 
5m, and signal gradually fades beyond 5m till disappearing at 7m position. 

The module includes ultrasonic transmitters, receiver and control circuit. The basic principle 
of work: 

1)

 

Using IO trigger for at least 10us high level signal; 

2)

 

The module automatically sends eight 40 kHz square waves and detect whether there is 
a pulse signal sent back.   

3)

 

If there's a signal sent back, output a high level through pin ECHO; the time duration is 
the time from sending the ultrasonic to the returning.   

Thus, 

test distance = (high level time × velocity of sound (340M/S) / 2

The timing diagram is as shown below. You only need to supply a short 10uS pulse to the 
trigger  input  to  start  the  ranging,  and  then  the  module  will  send  out  an  8-cycle  burst  of 

SunFounder

Summary of Contents for Smart Car Kit V2.0

Page 1: ... etc This car kit is a great platform for you to get started with robotics After assembling the car based on the instructions in this booklet you will learn how to operate the smart car through 6 experiments corresponding to the aforementioned movements Furthermore you can extend more functions or build your own robot based on what s learnt Note Go to LEARN Get Tutorials Smart Car Kit V2 0 for Ard...

Page 2: ...uino Board SunFounder Compatible 8 Install Arduino IDE 9 Add Libraries 12 Sensor Shield 13 Motor Driver Module 15 Step down DC DC Converter Module 17 Switch Module 19 Ultrasonic Module HC SR04 Distance Sensor 20 Line Follower Module 21 IR Receiver Module 22 Servo 22 Car Assembly 24 Front Wheels 24 Deflecting Plate Front Wheels 25 Deflecting Plate Rocker Arm 26 Rear Lower Plate Rear Wheels 27 Defle...

Page 3: ... Ultrasonic Line Follower 40 Other PCB Assembly 41 Circuit Building 42 Experiments 50 Experiment 1 Going Forward and Backward 50 Experiment 2 Turning Right and Left 50 Experiment 3 IR Remote Control 51 Experiment 4 Line Following 52 Experiment 5 Hand Tracking 54 Experiment 6 Obstacle Avoidance 54 S u n F o u n d e r ...

Page 4: ...1 Components List Acrylic Plate S u n F o u n d e r ...

Page 5: ...Screw 40 M3 10 Screw 10 M3 28 Screw 6 M4 10 Screw 8 M4 20 Screw 4 M3 10 Copper Standoff 16 M3 13 Copper Standoff 6 M3 25 Copper Standoff 6 M3 30 Copper Standoff 4 M3 35 Copper Standoff 4 M4 30 Copper Standoff 4 M1 6 Nut 6 M3 Nut 17 M4 Nut 4 M3 Self locking Nut 2 M4 Self locking Nut 4 S u n F o u n d e r ...

Page 6: ...Z Flange Bearing 4 Power Accessories Component Name Qty Tower Pro MG995 Micro Servo 1 Gear Motor 2 Driven Wheel 2 Driving Wheel 2 Electronic Accessories Component Name Qty SunFounder Uno 1 S u n F o u n d e r ...

Page 7: ...4 Sensor Shield 1 DC Motor Driver Module 1 Step down DC DC Converter Module 1 Switch Module 1 HC SR04 Ultrasonic Module 1 Line Follower Module 1 IR Receiver Module 1 S u n F o u n d e r ...

Page 8: ...Data Cable 1m 1 12cm Male to Male Jumper Wire 6 10cm Male to Female Jumper Wire 2 10cm Female to Female Jumper Wire 10 25cm 3 pin Anti reverse Cable 1 25cm 4 pin Anti reverse Cable 2 Tools Component Name Qty Cross Screwdriver 1 Cross Socket Wrench 1 S u n F o u n d e r ...

Page 9: ...ected batteries please purchase those with the anode bulged out as shown below so that it can ensure the well connection with the battery holder 3 If you only have batteries with the protected board it s ok To use it you can remove the board on the cathode But you should operate with care to avoid any hurt Since the metal shell is connected to the cathode for most batteries please don t use screw ...

Page 10: ...dules and sensors added the smart car can go forward go backward and turn left and right Besides it can realize IR remote control line following hand tracking obstacle avoidance etc Many boards and sensors are used in this project such as the sensor shield motor driver module step down DC DC converter module switch module ultrasonic ranging module photosensitive module obstacle avoidance module an...

Page 11: ...t in a short even when you know little of it It provides an integrated development environment IDE for code editing and compiling compatible with multiple control boards So you can just download the Arduino IDE upload the sketches i e the code files to the board and then you can see experimental phenomena For more information refer to http www arduino cc Arduino Board SunFounder Compatible In this...

Page 12: ...ge check the software list on the right side under Download the Arduino Software Find the one that suits your operation system and click to download There are two versions of Arduino for Windows Installer or ZIP file You re recommended to download the former Step 2 Double click the exe file and the following window will show up Click I Agree The following interface will show up S u n F o u n d e r...

Page 13: ...or enter a directory at the Destination Folder Click Install The following interface will show up After the installing progress bar goes to the end the Close button may be enabled for some PC Just click it to complete the installation S u n F o u n d e r ...

Page 14: ...ways trust software for Adafruit Industries and click Install Select Always trust software for Arduino srl and click Install After the installation is done click Close Then an Arduino icon will appear on the desktop S u n F o u n d e r ...

Page 15: ...brary Click Open 3 Similarly add IRromte zip and NewPing zip under Smart Car V2 0 for Arduino Code Library to library 4 Then you ll be prompted by Library added to your libraries Check Import libraries You also can see the libraries just imported have appeared on the list by going to Sketch Include Library MsTimer2 S u n F o u n d e r ...

Page 16: ...ctronic foundation to build various kinds of circuit By using this sensor shield you only need to wire components to the shield with some jumper wires and then you can build your own project quickly The sensor shield is one of the most common Arduino peripheral devices as shown below S u n F o u n d e r ...

Page 17: ...14 Its schematic diagram is as shown below note that VCC only supplies power to the devices connected to D2 hooked to the black servo and D3 Other components are powered by 5V S u n F o u n d e r ...

Page 18: ...15 Motor Driver Module The motor driver module is used to drive two motors to rotate The driver chip used here is L298N Its schematic diagram is as shown below S u n F o u n d e r ...

Page 19: ...tor is connected between this pin and ground to control the current of the load 2 3 Out 1 Out 2 Outputs of the Bridge A the current that flows through the load connected between these two pins is monitored at pin 1 4 Vs Supply Voltage for the Power Output Stages A non inductive 100nF capacitor must be connected between this pin and ground 5 7 Input1 Input2 TTL Compatible Inputs of the Bridge A 6 1...

Page 20: ...d terminals Please note that the motor is in the free stop state when the signal of enabled terminal is 0 When the enabled signal is 1 if IN1 and IN2 are 00 or 11 the motor is in brake state and the motor stops rotating If IN1 is 0 and IN2 is 1 the motor A rotates clockwise if IN1 is 1 and IN2 is 0 the motor A rotates counterclockwise This is the control method for motor A The control method for m...

Page 21: ... in comparison with popular three terminal linear regulators especially with higher input voltages The LM2596 operates at a switching frequency of 150 kHz thus allowing smaller sized filter components than what would be needed with lower frequency switching regulators It is available in a standard 5 lead TO 220 package with several different lead bend options and D2PAK surface mount package Featur...

Page 22: ...N OFF Allows the switching regulator circuit to be shut down using logic level signals thus dropping the total input supply current to approximately 80 µA Pulling this pin below a threshold voltage of approximately 1 3V turns the regulator on and pulling this pin above 1 3V up to a maximum of 25V shuts the regulator down If this shutdown feature is not needed the ON OFF pin can be wired to the gro...

Page 23: ...rol circuit The basic principle of work 1 Using IO trigger for at least 10us high level signal 2 The module automatically sends eight 40 kHz square waves and detect whether there is a pulse signal sent back 3 If there s a signal sent back output a high level through pin ECHO the time duration is the time from sending the ultrasonic to the returning Thus test distance high level time velocity of so...

Page 24: ...switch adopts a high transmit power infrared photodiode and a highly sensitive phototransistor It works by applying the principle of objects reflecting IR light the light is emitted then reflected and sensed by the synchronous circuit Then it determines whether there exists an object or not by the light intensity It can be used to easily identify black and white lines In other words the different ...

Page 25: ...similar with a normal plastic packaged transistor in size and it is suitable for all kinds of infrared remote control and infrared transmission Features High protection ability against EMI Circular lens for improved reception characteristics Line up for various center carrier frequencies Low voltage and low power consumption High immunity against ambient light Photodiode with integrated circuit TT...

Page 26: ...les you to easily rotate an object in a certain angle so it is widely used in model planes and robot joints Only the MG995 SG90 Micro Servo is used in this kit which is assembled on the front chassis of the car for steering structure S u n F o u n d e r ...

Page 27: ...c plates and driven wheel with an M4 20 screw and an M4 self locking nut Tighten the screws with the Cross Socket Wrench and the Cross Screwdriver 2 After assembly it is as shown below 3 Do not over tighten the nuts so that the wheel can spin smoothly S u n F o u n d e r ...

Page 28: ...the following acrylic plates and the assembled front wheel with M3 8 screws and M3 13 copper standoffs And fasten an M3 8 screw and an M3 35 copper standoff to the smaller acrylic plate 2 After assembly it is as shown below S u n F o u n d e r ...

Page 29: ...oosen the M4 nuts with the wrench and the screwdriver Deflecting Plate Rocker Arm 1 Fasten the following rocker arm of the SG90 servo to the deflecting plate with servo screws Packaged with the servo the servo screws are within the longer four of five screws The rocker arm is packaged with the servo together S u n F o u n d e r ...

Page 30: ...n below Note The screw is quite sharp at the end so be careful to assemble in case of getting hurt Rear Lower Plate Rear Wheels 1 Assemble the following acrylic plates together 2 After assembly it is as shown below S u n F o u n d e r ...

Page 31: ... following acrylic plates and gear motor with M3 28 screws and M3 nuts Assemble the driving wheel to the motor 4 After assembly it is as shown below 5 Connect the other driving wheel as shown below S u n F o u n d e r ...

Page 32: ...Tighten them with the cross wrench and the screwdriver do not over tighten them 2 After assembly it is as shown below Do not over tighten the screws so that the acrylic plate can move smoothly 3 Mount the IR Receiver module with M3 8 screws and M3 nuts 4 After assembly it is as shown below S u n F o u n d e r ...

Page 33: ...ith M4 10 screws M4 nuts and M4 30 copper standoffs Note You can tell the bottom and upside of the Chassis according to the holes distribution 2 After assembly it is as shown below 3 Fasten the Top Plate with M4 10 screws Looking at the upside sparse holes are on your right side S u n F o u n d e r ...

Page 34: ...31 4 After assembly it is as shown below 5 Fasten the acrylic plate for wire organizing to the chassis with an M3 10 screw and an M3 nut 6 After assembly S u n F o u n d e r ...

Page 35: ...32 7 Connect similarly the other 3 acrylic plates symmetrically 8 9 Fasten the chassis with M3 8 screws and M3 10 copper standoffs 10 After assembly it is as shown below S u n F o u n d e r ...

Page 36: ...side of the ribbon should be longer and the other is shorter With the ribbon you can remove the batteries easily Also you can skip this step 12 Fasten the chassis and the battery holder with M3 12 countersunk screws and M3 nuts 13 After assembly it s as follows S u n F o u n d e r ...

Page 37: ... 1 Connect the servo to the pin 2 of the sensor shield and the wiring should be as shown below Servo Brown to GND Red to VCC Orange to Signal pin2 Power Source Red to Black to Servo Power to VCC to GND S u n F o u n d e r ...

Page 38: ...t through Tools Board Arduino Genuino Uno 3 Then click to Tools Port COM5 your port may be different 4 Click the Upload icon The code is uploaded successfully when you are prompted Done Upload at the bottom 5 After uploading the code successfully you can hear a sound of the gear moving when the servo rotates It means the adjustment succeeds DO NOT plug out the servo wire yet Keep it power on and l...

Page 39: ... and Deflecting Plate should be perpendicular otherwise the front wheel will not be able to go straight as you control If it s not well assembled you should reinsert instead of rotating the servo shaft to adjust since the servo has been calibrated to 90 degrees If there is just a little deviation from the right position of the rocker arm it can be fine tuned by code 2 After assembly it is as shown...

Page 40: ...37 3 The bottom view Now you can remove the servo wires Chassis Driven Wheels 1 Fasten the Driven Wheels with M3 8 screws and M3 25 copper standoffs S u n F o u n d e r ...

Page 41: ...38 2 Fasten the Driven wheels and Chassis with M3 8 screws 3 After assembly it is as shown below 4 Mount the following acrylic plate on the car with M3 10 screws and M3 nuts S u n F o u n d e r ...

Page 42: ...39 5 After assembly it is as shown below 6 Then assemble the ultrasonic fixing plate to the car with an M3 10 screw and M3 nut 7 After assembly it is as shown below S u n F o u n d e r ...

Page 43: ...iver Ultrasonic Line Follower 1 The ultrasonic module with M1 5 8 screws and M1 6 nuts while the line follower with M3 8 screws and M3 30 copper standoffs 2 After assembly it is as shown below S u n F o u n d e r ...

Page 44: ...Motor Driver Module the Switch Module the Step down DC DC Converter Module and the SunFounder Uno board with M3 6 screws and then plug the sensor shield into the Uno board as shown below 2 The assembly should be like this S u n F o u n d e r ...

Page 45: ...42 The top view Circuit Building 1 Connect the motor driver module and sensor shield Motor Driver Module Sensor Shield 5V 5V ENA 5 INT1 8 INT2 9 INT3 10 INT4 11 ENB 6 S u n F o u n d e r ...

Page 46: ...43 S u n F o u n d e r ...

Page 47: ...o not know how to distinguish you can try wiring them randomly first Then burn the code under the path Smart Car V2 0 for Arduino Code Car_1_Forward to the board to see whether the car moves forward If it does you ve wired them correctly If not you may need to change the wiring until the car moves forward 3 Connect the sensor shield and the servo Servo Sensor Shield Red Wire 5v Brown Wire GND Sign...

Page 48: ...45 S u n F o u n d e r ...

Page 49: ...The two pins of the battery holder should not be in contact otherwise it will cause a short circuit and the battery will be burnt 5 Connect the IR receiver module and the sensor shield IR Receiver Module Sensor Shield SIG yellow 7 GND black GND VCC red 5V S u n F o u n d e r ...

Page 50: ... wiring connection is shown as below 6 Connect the line follower module and the sensor shield Line Follower Module Sensor Shield GND black GND VCC red 5V SDA yellow A4 SDA SCL white A5 SCL S u n F o u n d e r ...

Page 51: ... reverse cable to the ultrasonic module and connect the pins as follows Note Pay attention to the wires The anti reverse cable s red and black wires do NOT connect to the anode and cathode HC SR04 Ultrasonic Module Sensor Shield GND white GND VCC yellow 5V ECHO red 12 TRIG black 13 The wiring connection is shown as below S u n F o u n d e r ...

Page 52: ...he assembly and circuits are finished if you feel the wires are too messy you may wrap them with the heat shrink tubing so the car can look more adorable with neat wiring Now let s get started S u n F o u n d e r ...

Page 53: ...which drive the wheels accordingly Thus the car begins to walk Experimental Phenomena When you press down the button of the switch module the car starts to go straight 2 seconds later it starts to go backwards and then stops after another 2 seconds If you press down the button for a second time the car will start to walk again If you want to change the time the car walks you can modify the sketch ...

Page 54: ...n on the corresponding function once it receives the instruction For example press 2 and a string will be sent thus the car will just go forward because the string means to drive the car to do so in the code Experimental Procedures Connect the SunFounder Uno board to your computer via a USB cable Upload the sketch under the path Smart Car V2 0 for Arduino Code Car_3_Remote and then remove the USB ...

Page 55: ...hen passed to the car thus the car would turn its direction accordingly to follow the line by servo rotation Experimental Procedures Connect the SunFounder Uno board to your computer Upload the sketch under the path Smart Car V2 0 for Arduino Code Car_4_LineFollowing and then remove the USB cable Pressed the button on the switch module Notes 1 If the surrounding is too dark you can turn on the LED...

Page 56: ...l of black line detection is too weak just adjust the potentiometer below to try Normally you don t need to adjust Now draw a black line on a large white board start the car and it will go following the line It will stop when no black line is detected so for better performance you can draw a closed path like a number 8 shaped route or a circle S u n F o u n d e r ...

Page 57: ...andTracking and then remove the USB cable Experimental Phenomena Turn on the car keep your hand moving 0 to 10cm in its front and then the car will move accordingly looks like you push it it runs backward when your palm approaches when your hand is 10 to 25cm ahead move back from the car and it will move forward When you take the hand away it will stop Note The car can only move forward or backwar...

Page 58: ...DO NOT increase the car s speed too much in case that the sensor in the front may be damaged due to great inertial effect upon stop Besides the ultrasonic can only detects the obstacle in front of the car that is the car will turn right every time it detects an obstacle 30cm in front Experimental Phenomena Turn on the switch When the car detects an obstacle in front within 30cm it will turn right ...

Page 59: ...al study investigation enjoyment or other non commercial or nonprofit purposes under the related regulations and copyrights laws without infringing the legal rights of the author and relevant right holders For any individual or organization that uses these for commercial profit without permission the Company reserves the right to take legal action S u n F o u n d e r ...

Reviews: