loading

AUTOSPORT: This month, HackerBox Hackers are exploring automotive electronics. This Instructable contains information for working with HackerBoxes #0013. If you would like to receive a box like this right to your mailbox each month, now is the time to subscribe at HackerBoxes.com and join the revolution!

Topics and Learning Objectives for this HackerBox:

  • Adapting the NodeMCU for Arduino
  • Assembling a 2WD Car Kit
  • Wiring a NodeMCU to control a 2WD Car Kit
  • Controlling a NodeMCU over WiFi using Blynk
  • Using Sensors for Autonomous Navigation
  • Working with Automotive On-board Diagnostics (OBD)

HackerBoxes is the monthly subscription box service for DIY electronics and computer technology. We are hobbyists, makers, and experimenters. Hack the Planet!

Step 1: HackerBoxes 0013: Box Contents

  • HackerBoxes #0013 Collectable Reference Card
  • 2WD Car Chassis Kit
  • NodeMCU WiFi Processor Module
  • Motor Shield for NodeMCU
  • Jumper Block for Motor Shield
  • Battery Box (4 x AA)
  • HC-SR04 Ultrasonic Ranging Sensor
  • TCRT5000 IR Reflectivity Sensors
  • DuPont female-female jumpers 10cm
  • Two Red Laser Modules
  • Mini-ELM327 on-board diagnostics (OBD)
  • Exclusive HackerBoxes Racing Decal

Some other things that will be helpful:

  • Four AA Batteries
  • Double-Sided Foam Tape or Velcro Strips
  • microUSB Cable
  • Smart Phone or Tablet
  • Computer with Arduino IDE

Most importantly, you will need a sense of adventure, DIY spirit, and hacker curiosity. Hardcore hobbyist electronics isn't always easy, but when you persist and enjoy the adventure, a great deal of satisfaction may be derived from persevering and getting your projects working. Just take each step slowly, mind the details, and don't hesitate to ask for help.

Step 2: Automotive Electronics and Self Driving Cars

Automotive electronics are any electronic systems used in road vehicles. These include carputers, telematics, in-car entertainment systems, and so forth. Automotive electronics originated from the need to control engines. The first were used to control engine functions and were referred to as engine control units (ECU). As electronic controls began to be used for more automotive applications, the acronym ECU took on the more general meaning of "electronic control unit", and then specific ECUs were developed. Now, ECUs are modular. Two types include engine control modules (ECM) or transmission control modules (TCM). A modern car may have up to 100 ECUs.

Radio-controlled cars (R/C cars) are cars or trucks that can be controlled from a distance using a specialized transmitter or remote. The term "R/C" has been used to mean both "remote controlled" and "radio controlled", but common use of "R/C" today usually refers to vehicles controlled by a radio-frequency link.

An autonomous car (driverless car, self-driving car, robotic car) is a vehicle that is capable of sensing its environment and navigating without human input. Autonomous cars can detect surroundings using a variety of techniques such as radar, lidar, GPS, odometry, and computer vision. Advanced control systems interpret sensory information to identify appropriate navigation paths, as well as obstacles and relevant signage. Autonomous cars have control systems that are capable of analyzing sensory data to distinguish between different cars on the road, which is very useful in planning a path to the desired destination.

Step 3: Arduino for NodeMCU

NodeMCU is an open source IoT platform. It includes firmware which runs on the ESP8266 Wi-Fi SoC from Espressif Systems and hardware based on the ESP-12 module.

The Arduino IDE can now be easily extended to support programing NodeMCU modules as though they were any other Arduino development platform.

To start, make sure you have the Arduino IDE installed (www.arduino.cc) as well as drivers for the appropriate Serial-USB chip on the NodeMCU module you are using. Currently most NodeMCU modules include the CH340 Serial-USB chip. The manufacturer of the CH340 chips (WCH.cn) has drivers available for all popular operating systems. Check out the Google translation page for their site.

Run the Ardino IDE, go into preferences,and locate the field for entering "Additional Board Manager URLs"

Paste in this URL:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

To install the Board Manager for ESP8266.

After install, close the IDE and then start it back up.

Now connect the NodeMCU module to your computer using a microUSB cable (as used by most mobile phones and tablets).

Select the board type within the Arduino IDE as NodeMCU 1.0

We always like to load and test the blink demo on a new Arduino board just to get some confidence that everything is working correctly. The NodeMCU is no exception, but you have to change the LED pin from pin13 to pin16 before compiling and uploading. Make sure this quick test works correctly before moving on to anything more complicated with the Arduino NodeMCU.

Here is an instructable that goes over the setup process for Arduino NodeMCU with some different application examples. It is a bit astray from the objective here, but it may be helpful to look at for another point of view if you get stuck.

Step 4: 2WD Car Chassis Kit

2WD Car Chassis Kit contents:

  • Aluminum Chassis (colors vary)
  • Two FM90 DC Motors
  • Two Wheels with Rubber Tires
  • Freewheel Caster
  • Assembly Hardware
  • Mounting Hardware

The FM90 DC Motors look like micro servos because they are built in same plastic housing as common micro servos, such as the FS90, FS90R, or SG92R. However, the FM90 is not a servo. The FM90 is a DC motor with a plastic gear-train.

The FM90 motor's speed is controlled by pulse width modulating (PWM) the power leads. Direction is controlled by swapping the power polarity as with any brushed DC motor. The FM90 can run on 4-6 Volts DC. While small, it does draw enough current that it should not be driven directly from a microcontroller pin. A motor driver or H-bridge should be used.

FM90 DC Motor Specs:

  • Dimensions: 32.3mm x 12.3mm x 29.9mm / 1.3" x 0.49" x 1.2"
  • Spline Count: 21
  • Weight: 8.4g
  • No load speed: 110RPM (4.8v) / 130RPM (6v)
  • Running Current (at no load): 100mA (4.8v) / 120mA (6v)
  • Peak Stall Torque (4.8v): 1.3 kg/cm / 18.09 oz/in
  • Peak Stall Torque (6v): 1.5 kg/cm / 20.86 oz/in
  • Stall Current: 550mA (4.8v) / 650mA (6v)

Step 5: Car Chassis: Mechanical Assembly

The Car Chassis can be easily assembled according to this diagram.

Note that there are two small bags of hardware. One includes Mounting Hardware with six brass 5mm-M3 standoffs along with matching screws and nuts. This mounting hardware may be useful in later steps of mounting controllers, sensors, and other items to the chassis.

For this step, we will use the Assembly Hardware which includes:

  • Four thin M2x8 bolts and small matching nuts for affixing the motors
  • Four thicker M3x10 bolts and larger matching nuts for affixing the caster wheel
  • Two PB2.0x8 screws with coarse threads for affixing the wheels to the motors

Note that the FM90 motors are oriented such that the wire leads extend from the rear of the assembled chassis.

Step 6: Car Chassis: Add Power Pack and Controller

The ESP-12E motor shield board supports directly plugging the NodeMCU module. The motor shield includes an L293DD push-pull motor driver chip (datasheet). The motor wire leads should be wired to the A+/A- and B+/B- screw terminals on the motor shield (after removing the connectors). The battery leads should be wired to the battery input screw terminals.

If one of the wheels turns in the wrong direction, the wires to the corresponding motor can be swapped at the screw terminals, or the direction bit can be inverted in the code (next step).

There is a plastic power button on the motor shield to activate the battery input supply. The jumper block can be used to route power to the NodeMCU from the motor shield. Without the jumper block installed, the NodeMCU can power itself from the USB cable. With the jumper block installed (as shown), the battery power supplies the motors and is also driven to the NodeMCU module.

The motor shield and the battery pack can mounted to the chassis by lining up the screw holes with available openings in the aluminum chassis. However, we find it easier to just affix them to the chassis using double-sided foam tape or adhesive velcro strips.

Step 7: Car Chassis: Programming and Wi-Fi Control

Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, and other hardware over the Internet. It's a digital dashboard where you can build a graphic interface for your project by simply dragging and dropping widgets. It's really simple to set everything up and you'll start tinkering right away. Blynk will get you online and ready for the Internet Of Your Things.

The HBcar.ino Arduino script included here shows how to interface four buttons (forward, reverse, right, and left) on a Blynk project to control the motors on the 2WD car chassis.

Prior to compiling, three strings need to be changed in the program:

  • Wi-Fi SSID (for your Wi-Fi access point)
  • Wi-Fi Password (for your Wi-Fi access point)
  • Blynk Authorization Token (from your Blynk project)

Note from the example code that L293DD chip on the motor shield is wired up as follows:

  • GPIO pin 5 for motor A speed
  • GPIO pin 0 for motor A direction
  • GPIO pin 4 for motor B speed
  • GPIO pin 2 for motor B direction

Step 8: Sensors for Autonomous Navigation: Ultrasonic Range Finder

The HC-SR04 ultrasonic range finder (datasheet) can provide measurements from about 2cm to 400cm with an accuracy up to 3mm. The HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit.

After attaching four female-female jumpers to the pins of the HC-SR04, wrapping some tape around the connectors can help to both insulate the connections from shorting to the aluminum chassis and also provide a pliable mass to wedge into the slot at the front of the chassis as shown.

In this example, the four pins on the HC-SR04 can be wired to the motor shield:

  • VCC (on HC-SR04) to VIN (on motor shield)
  • Trigger (on HC-SR04) to D6 (on motor shield)
  • Echo (on HC-SR04) to D7 (on motor shield)
  • GND (on HC-SR04) to GND (on motor shield)

VIN will supply about 6VDC to the HC-SR04, which only needs 5V. However, that seems to work fine. The other available power rail (3.3V) is sometimes adequate to power the HC-SR04 module (certainly give it a try), but sometimes it is not enough voltage.

Once this is wired up, try out the example code NodeMCUping.ino to test operation of the HC-SR04. The distance from the sensor to any object is printed on the serial monitor (9600 board) in centimeters. Get our ruler and test the accuracy. Impressive isn't it?

Now that you have this hint, try something like this for a collision-avoiding, autonomous vehicle:

  1. forward until distance < 10cm
  2. halt
  3. reverse a small distance (optional)
  4. turn a random angle (time)
  5. loop to step 1

For some general background information, here is a tutorial video full of details for using the HC-SR04 module.

Step 9: Sensors for Autonomous Navigation: Infrared (IR) Reflectivity

The IR Reflective Sensor module utilizes a TCRT5000 (datasheet) to detect color and distance. The module emits IR light and then detects if it receives a reflection. Thanks to its ability to sense if a surface is white or black, this sensor is often used in line following robots and auto data logging on utility meters.

The measuring distance range is from 1mm to 8mm, and the central point is about 2.5mm. There is also an on-board potentiometer to adjust the sensitivity. The IR diode will emit IR light continuously when the module is connected to power. When the emitted infrared light is not been reflected, the triode will be in the off state causing the digital (D0) output to indicate a logic LOW.

Step 10: Laser Beams

These common 5mW 5V laser modules can be used to add red laser beams to pretty much anything that has 5V power available.

Note that these modules can be easily damaged, so HackerBox #0013 includes a couple to provide a back-up. Take care with your laser modules!

Step 11: Automotive On-board Diagnostics (OBD)

On-board diagnostics (OBD) is an automotive term referring to a vehicle's self-diagnostic and reporting capability. OBD systems give the vehicle owner or repair technician access to the status of the various vehicle subsystems. The amount of diagnostic information available via OBD has varied widely since its introduction in the early 1980s versions of on-board vehicle computers. Early versions of OBD would simply illuminate a malfunction indicator light if a problem was detected but would not provide any information as to the nature of the problem. Modern OBD implementations use a standardized digital communications port to provide real-time data in addition to a standardized series of diagnostic trouble codes, or DTCs, which allow one to rapidly identify and remedy malfunctions within the vehicle.

OBD-II is an improvement in both capability and standardization. The OBD-II standard specifies the type of diagnostic connector and its pinout, the electrical signalling protocols available, and the messaging format. It also provides a candidate list of vehicle parameters to monitor along with how to encode the data for each. There is a pin in the connector that provides power for the scan tool from the vehicle battery, which eliminates the need to connect a scan tool to a power source separately. OBD-II Diagnostic Trouble Codes are 4-digit, preceded by a letter: P for engine and transmission (powertrain), B for body, C for chassis, and U for network. Manufacturers may also add custom data parameters to their specific OBD-II implementation, including real-time data requests as well as trouble codes.

The ELM327 is a programmed microcontroller for interfacing to the on-board diagnostics (OBD) interface found in most modern cars. The ELM327 command protocol is one of the most popular PC-to-OBD interface standards and is also implemented by other vendors. The original ELM327 is implemented on the PIC18F2480 microcontroller from Microchip Technology. The ELM327 abstracts the low-level protocol and presents a simple interface that can be called via a UART, typically by a hand-held diagnostic tool or a computer program connected by USB, RS-232, Bluetooth or Wi-Fi. The function of such software may include supplementary vehicle instrumentation, reporting of error codes, and clearing error codes.

While Torque is probably the most well known, there are many applications that can be used with the ELM327.

Step 12: Hack the Planet

Thank you for sharing our adventure into automotive electronics. If you have enjoyed this Instrucable and would like to have a box of electronics projects like this delivered right to your mailbox each month, please join us by SUBSCRIBING HERE.

Reach out and share your success in the comments below and/or on the HackerBoxes Facebook page. Certainly let us know if you have any questions or need some help with anything. Thank you for being part of HackerBoxes. Please keep your suggestions and feedback coming. HackerBoxes are YOUR boxes. Let's make something great!

<p>Done minus the IR sensors. I want to re-write some of the autonomous code before I add them in.</p>
<p>Can you show us an example of your code.<br>I am having difficulties with this particular part.</p>
<p>Here is my code so far but it still only turns left when it hits an obstacle. I think the code can do better so I'm not done tweaking yet.</p><p>#include &lt;ESP8266WiFi.h&gt;</p><p>#define RightMotorSpeed 5</p><p>#define RightMotorDir 0</p><p>#define LeftMotorSpeed 4</p><p>#define LeftMotorDir 2</p><p>#define echoPin 12 // Echo Pin</p><p>#define trigPin 13 // Trigger Pin</p><p>#define LEDPin 16 // Onboard LED</p><p>int maximumRange = 200; // Maximum range needed</p><p>int minimumRange = 0; // Minimum range needed</p><p>long duration, distance; // Duration used to calculate distance</p><p>void setup()</p><p>{</p><p> Serial.begin(9600);</p><p> pinMode(RightMotorSpeed, OUTPUT);</p><p> pinMode(RightMotorDir, OUTPUT);</p><p> pinMode(LeftMotorSpeed, OUTPUT);</p><p> pinMode(LeftMotorDir, OUTPUT); </p><p> pinMode(trigPin, OUTPUT);</p><p> pinMode(echoPin, INPUT);</p><p>}</p><p>void loop()</p><p>{</p><p> /* The following trigPin/echoPin cycle is used to determine the</p><p> distance of the nearest object by bouncing soundwaves off of it. */ </p><p> digitalWrite(trigPin, LOW); </p><p> delayMicroseconds(2); </p><p> digitalWrite(trigPin, HIGH);</p><p> delayMicroseconds(10); </p><p> digitalWrite(trigPin, LOW);</p><p> duration = pulseIn(echoPin, HIGH);</p><p> //Calculate the distance (in cm) based on the speed of sound.</p><p> distance = duration/58.2;</p><p> if (distance &gt;= maximumRange || distance &lt;= minimumRange)</p><p> {</p><p> // sensor garbage -- stop 1/4 sec</p><p> halt();</p><p> delay(250);</p><p> }</p><p> else if (distance &lt;= 5)</p><p> {</p><p> halt();</p><p> delay(50);</p><p> reverse();</p><p> delay(50);</p><p> // random direction unless already committed to a direction but change if stuck.</p><p> left();</p><p> }</p><p> else</p><p> {</p><p> forward();</p><p> }</p><p> delay(50);</p><p>}</p><p>void halt()</p><p>{</p><p> digitalWrite(RightMotorSpeed, LOW);</p><p> digitalWrite(LeftMotorSpeed, LOW);</p><p>}</p><p>void forward()</p><p>{</p><p> digitalWrite(RightMotorDir, LOW);</p><p> digitalWrite(LeftMotorDir, HIGH);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void reverse()</p><p>{</p><p> digitalWrite(RightMotorDir, HIGH);</p><p> digitalWrite(LeftMotorDir, LOW);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void left()</p><p>{</p><p> digitalWrite(RightMotorDir, HIGH);</p><p> digitalWrite(LeftMotorDir, HIGH);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void right()</p><p>{</p><p> digitalWrite(RightMotorDir, LOW);</p><p> digitalWrite(LeftMotorDir, LOW);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p>
<p>Thank you!</p><p>I did get this far.</p><p>I guess to clarify what i am attempting to do is implement this functionality to Blynk at first by displaying the values from the HC-SR04 on my phone. But I am having difficulties getting the car to accept the commands and display the values. I believe it might be an issue with timing on the device and the app. But I am not sure.</p>
<p>Mine sends the value back to blynk. Here is the code: <a href="https://github.com/surak/arduino/tree/master/car-blynk" rel="nofollow"> https://github.com/surak/arduino/tree/master/car-...</a></p><p>And you can see the Blynk interface here. It's just a label attached to virtual pin 10.</p>
<p>I uploaded your code, but found some errors when I tried to install it. After deleting some things, I was able to get it to function through blynk remotely, but still not autonomously. Am I missing something?</p>
<p>Hey Fransisco,</p><p>I ended up doing what you're describing. One thing to watch our for is that the code to get the distance from the ultrasonic sensor doesn't block the code which drives the motors. That may cause some weird delays. In case you're curious, here's the code i used. It sends the data to the phone once per half second and seems to work pretty well. You may need to modify the forward/right/left/reverse functions based on how you wired things:</p><p>#define BLYNK_PRINT Serial</p><p>#include &lt;ESP8266WiFi.h&gt;</p><p>#include &lt;BlynkSimpleEsp8266.h&gt;</p><p>#include &lt;SimpleTimer.h&gt;</p><p>#define RightMotorSpeed 5</p><p>#define RightMotorDir 0</p><p>#define LeftMotorSpeed 4</p><p>#define LeftMotorDir 2</p><p>#define ECHO_PIN 13</p><p>#define TRIG_PIN 12</p><p>#define LED_PIN 16</p><p>char auth[] = &quot;&quot;;</p><p>char ssid[] = &quot;&quot;;</p><p>char pass[] = &quot;&quot;;</p><p>SimpleTimer timer;</p><p>void setup()</p><p>{</p><p> Serial.begin(9600);</p><p> Blynk.begin(auth, ssid, pass);</p><p> pinMode(ECHO_PIN, INPUT);</p><p> pinMode(TRIG_PIN, OUTPUT);</p><p> pinMode(LED_PIN, OUTPUT);</p><p> pinMode(RightMotorSpeed, OUTPUT);</p><p> pinMode(RightMotorDir, OUTPUT);</p><p> pinMode(LeftMotorSpeed, OUTPUT);</p><p> pinMode(LeftMotorDir, OUTPUT);</p><p> timer.setInterval(500, sendDistanceData);</p><p>}</p><p>long getDistance() {</p><p> digitalWrite(TRIG_PIN, LOW); </p><p> delayMicroseconds(2); </p><p> digitalWrite(TRIG_PIN, HIGH);</p><p> delayMicroseconds(10); </p><p> digitalWrite(TRIG_PIN, LOW);</p><p> long duration = pulseIn(ECHO_PIN, HIGH);</p><p> return duration/58.2; </p><p>}</p><p>void blink() {</p><p> long distance = getDistance();</p><p> digitalWrite(LED_PIN, HIGH);</p><p> delay(distance * 10);</p><p> digitalWrite(LED_PIN, LOW);</p><p>}</p><p>void sendDistanceData() {</p><p> Blynk.virtualWrite(10, getDistance()); </p><p>}</p><p>void loop()</p><p>{</p><p> Blynk.run();</p><p> timer.run();</p><p>}</p><p>void halt()</p><p>{</p><p> digitalWrite(RightMotorSpeed, LOW);</p><p> digitalWrite(LeftMotorSpeed, LOW);</p><p>}</p><p>void forward()</p><p>{</p><p> digitalWrite(RightMotorDir, LOW);</p><p> digitalWrite(LeftMotorDir, HIGH);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void reverse()</p><p>{</p><p> digitalWrite(RightMotorDir, HIGH);</p><p> digitalWrite(LeftMotorDir, LOW);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void right()</p><p>{</p><p> digitalWrite(RightMotorDir, LOW);</p><p> digitalWrite(LeftMotorDir, LOW);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>void left()</p><p>{</p><p> digitalWrite(RightMotorDir, HIGH);</p><p> digitalWrite(LeftMotorDir, HIGH);</p><p> digitalWrite(RightMotorSpeed, HIGH);</p><p> digitalWrite(LeftMotorSpeed, HIGH);</p><p>}</p><p>BLYNK_WRITE(V0)</p><p>{</p><p> if (param[0]) {</p><p> forward();</p><p> }</p><p> else {</p><p> halt();</p><p> }</p><p>}</p><p>BLYNK_WRITE(V1)</p><p>{</p><p> if (param[0]) {</p><p> reverse();</p><p> }</p><p> else {</p><p> halt();</p><p> }</p><p>}</p><p>BLYNK_WRITE(V2)</p><p>{</p><p> if (param[0]) {</p><p> right();</p><p> }</p><p> else {</p><p> halt();</p><p> }</p><p>}</p><p>BLYNK_WRITE(V3)</p><p>{</p><p> if (param[0]) {</p><p> left();</p><p> }</p><p> else {</p><p> halt();</p><p> }</p><p>}</p>
<p>If you follow the tutorial exactly, these won't match for the directions, just FYI</p>
<p>Sorry. I haven't tried this. I had a plan to eliminate Blynk. It is cool but when I considered autonomous vehicle I considered Blynk baggage I didn't need.</p>
<p>Francisco - </p><p>If you're just trying to get data to the phone, Blynk makes pushing your sensor data really easy with &quot;virtualWrite&quot;. Here's an example of how to send the ultrasonic data back to the phone app: </p><p><a href="http://pastebin.com/NE8zdJpK">http://pastebin.com/NE8zdJpK</a></p><p>The example uses board pins D6 and D7 / gpio pins 12 and 13, for the echo and trigger on the sensor respectively. It's all commented in the code too. Hope you get it working.</p>
<p>Sorry bud. I couldn't help. Once I started to program the autonomous part I stripped out the Blynk code and set everything direct, Good luck though. Please share what any of your accomplishments though.</p>
<p>This is my first Hackerbox - and I have struggled through a few issues. The current issue is the sonic sensor. I was convinced that the part was defective. But I think what is really going on are the instructions provided for the pin connections seem to be wrong.</p><p>From above:</p><ul><li>Trigger (on HC-SR04) to D6 (on motor shield)<li>Echo (on HC-SR04) to D7 (on motor shield)</ul><p>From code sketch sample</p><p>#define echoPin 12 // Echo Pin, implies D7 = 12<br>#define trigPin 13 // Trigger Pin, implies D6 = 13</p><p>But <a href="https://github.com/esp8266/Arduino/blob/master/variants/wifinfo/pins_arduino.h" rel="nofollow">https://github.com/esp8266/Arduino/blob/master/var...</a> says:</p><p>static const uint8_t D6 = 12; <br>static const uint8_t D7 = 13;</p><p>I am curious if others have just wired it backwards, or if there are different revisions of the hardware that have these inverted?</p><p>Regardless, if I invert D6 and D7 - my Ultrasonic Sensor starts spitting out useful data -- I suppose you could keep the wiring the same, but update the sketch file with</p><p>#define echoPin 13</p><p>#define trigPin 12</p><p>Good luck all</p>
<p>Yes, when I inverted mine began pouring out data. Prior my only output was a repeating -1.</p><p>Thanks for posting this</p>
<p>I did the same thing with the sensor. Thanks for sharing that link though. I've been halfheartedly looking for a pin definition. That helps out greatly.</p>
<p>Your project made me redo mine :-) I was not happy with the weigh of the battery in front, which made it topple over and over. Now I move the electronics to the front and I'm able to use a powerpack over the wheels, which is much better than the 4 aaa batteries in every way.</p>
<p>Yeah it works much better with the weight in the back. I originally built it with the batteries in the front and like you I wasn't happy with the results (always tipping). Now with the weight moved to the back there is no tipping. Nice job!</p>
<p>I need to buy some wiring. What came in the box isn't long enough.</p>
<p>Yeah, agreed. I was able to scrounge some red and black wire that was long enough. I removed the DC motor shrouds, de-soldered the existing wires, and soldered my own longer wires (replacing shroud afterward)</p>
<p>What gauge wire are you using?</p>
<p>I think it's 22g. It's the same stranded wire that came with the box. I just happened to have some wire from previous boxes / projects</p>
<p>My favorite box so far BTW (out of 4)</p>
<p>Done it!!!</p><p>Some notes:</p><p>From the original .ino replace the quotes with normal ones so it compiles</p><p>One of the motors is reversed so switch polarity</p><p>To get the Blynk app running point the buttons to the proper Vn pins</p><p>Cant wait to explore playing with power/acceleration of this motor sheild</p>
<p>Example using the joystick in blynk, much nicer to control</p>
<p>Has anybody got the ELM327 working? The posted link to application is for IOS/Android (and I dont see how we can use this on IOS because at least from my reading, ios devices dont support serial over bluetooth)... so are we stuck android only? I've successfully paired the unit to my macboook pro but neither app I tried could connect to it here either. I've tried EOBD Facile and OBD Auto Doctor</p>
<p>I got it working with an Android. (I know that doesn't particularly 'help' with you asking about iOS, but sometimes confirmation someone got it working is enough to keep you going.)<br><br>I did however disconnected quickly after shutting the car of--- and it set off the security system so my Jeep spent 5 minutes honking and flashing in teh driveway. ;-)</p>
<p>Which app did you use to talk to the ELM327? I couldn't seem to get it to communicate with my android.</p>
<p>As I recall, I used &quot;Torque (Lite)&quot;, the free version. I also have the &quot;ELM327 ODB Terminal&quot; installed, but I did not use that as I recall.<br>I initially wasn't able to see the module but after a bit (and maybe an unplug or two fiddling with it) I was able to see it when I rescanned for pair-able devices. The device name I have is simply &quot;ODBII&quot;.</p>
<p>Same here. Does not work with iPhone 7. Paired with MacBook Pro but did not connect with EOBD Facile application. I'd be interested to know if anyone has gotten this little device to work with any iOS or OS X system.</p>
<p>Here is an interesting post that I came across that seems to explain what's going on https://www.lifewire.com/elm327-iphone-adapter-doesnt-work-534643</p>
<p>No luck getting the EML327 working on an iPhone either. From what I have read only iOS devices that run pre iOS 5 can use serial over bluetooth so I think we are out of luck for the iPhone/iPad department.</p>
<p>I have done steps 1 through 8. So far I have a 100% success rate at nothing working. I get error codes on the HBcar.ino. I get absolutely nothing on NodeMCUping.ino. Apparently I'm stupid enough to build computer networks, make WANs work &amp; cannot get this to work. What the hell am I doing wrong? Oh &amp; apparently I cannot get a frigging bluetooth device to work. Because while I figured out that the ELM had to be paired within the first 10 seconds of getting power, I can't get any app to recognize it. Someone please help me resolve this insanity because right now I'll have better results if I were to stick everything in the microwave for 20 minutes. &amp; Yes, I've cancelled my subscription. I can't get box #1 to work, why bother accumulating any more.</p>
<p>Line Follower RC car:</p><p>Video: </p><p>https://www.youtube.com/watch?v=qV57Pfr3YtA</p><p>Arduino Code: </p><p>https://github.com/AnandVetcha/HackerBox/tree/master/Box13/LineFollow_RC</p>
<p>Guys i could implement Autonomous RC car along with Blynk companion interface. I got the motivation to display reading from Ultrasonic sensor from AlexandreS15 and many more from other community members.</p><p>Thanks for motivating me to make this project.</p><p>GitHub code: <a href="https://github.com/AnandVetcha/HackerBox/tree/master/Box13/Autonomous_RC_car" rel="nofollow">https://github.com/AnandVetcha/HackerBox/tree/mast...</a></p>
<p>I would like some help with the actual pinout of the motor controller. The pins don't seem to relate to the nodemcu in a logical way. There are some pins which are also pointing to the motors and so on. On the code, it does things like </p><p>#define RightMotorSpeed 5<br>#define RightMotorDir 0<br>#define LeftMotorSpeed 4<br>#define LeftMotorDir 2<br>digitalWrite(RightMotorDir, HIGH);<br>digitalWrite(LeftMotorDir, LOW);<br>digitalWrite(RightMotorSpeed, HIGH);<br>digitalWrite(LeftMotorSpeed, HIGH);</p><p>To move left, for example. </p>
<p>So what can we do with that laser? <br>The laser looks cool but there are only 2 connections (+/-). I discovered some laser modules with 3 pins. Is this one only for some laser decoration?</p><p>Great Box so far. Ah and on Arch Linux no driver needs to be installed and flashing the Node works fine.</p>
<p>Perhaps the lasers could be used with the IR detectors? Do lasers like this emit IR as well - perhaps when the IR detectors are close enough to an obstacle they the laser light will bounce back with sufficient intensity to read?</p>
<p>Have you found it out? I'm also curious...</p>
I use it for decoration only now :)
<p>How? I ran it from an Arduino UNO, now I'll integrate into this one. Have a look at https://surak.wordpress.com/2017/01/07/running-a-5v-5mw-650nm-laser-from-arduino/</p>
<p>I've had a lot of fun with this box so far (my first one). I was able to get the car hooked up with the ultrasonic sensor. How did everyone else got the motors' power leads into the screw terminals? I ended up cutting wire, stripping it with a knife, twisting the ends, and was pretty surprised when it worked. I also discarded the metal pieces inside the screw terminal (not the screw) since they seemed to just be getting in the way. I did a little searching online but couldn't find if there's a more standard way to do this.</p><p>Getting the IR sensor hooked up should be an interesting challenge.</p>
<p>I cant get the arduino.idu to list NodeMCU.</p><p>Point of reference, I'm pretty new to all of this.</p>
<p>nm, got it... I'll be back with more questions soon.</p>
<p>ok, my computer won't recognize the NodeMCU to upload hbcar.ino.</p><p>Any siggestions?</p>
<p>Assuming you are on Windows - do you have the correct COM port selected in Arduino IDE?</p>
<p>win 10 surface Pro. There was only one COM Port listed. The nodeMCU lit up when i plugged it into the computer.</p>
<p>Do you have the correct board selected? </p>
<p>yes, I had trouble getting the right board to begin with. Here's my current issue.</p>
<p>For that issue, you need the Blynk libraries installed in your arduino 'libraries' folder.<br>Here is the source for that file: </p><p><a href="https://github.com/blynkkk/blynk-library" rel="nofollow">https://github.com/blynkkk/blynk-library </a> <br><br>Just dump the whole unzipped folder, it'll be called 'blynk-library-master', into the libraries folder under the arduino directory. After that it should find that file just fine for you.</p>
<p>That saved my day NoviceAttempts. I could not get the code to compile for nothing. Having the library, I would think, should be a step mentioned somewhere. </p>
<p>Thank you! The level of frustration was real.</p>

About This Instructable

15,304views

17favorites

License:

More by HackerBoxes:HackerBoxes 0019: Raspberry WiFi HackerBoxes 0018: Circuit Circus HackerBoxes 0017: Power Maker 
Add instructable to: