Wifi controlled car using bolt wifi module and arduino uno error with controller.html

I have done all hardware connections of the project and my bolt cloud shows the status as online of my device.

I m confused as the controller.html is not working

M I suppose to link the wifi blot module to some product on the bolt cloud ??? Pls solve my query

Hi @erinepereira27,

For the WiFi controller car, you do not need to link the Bolt WiFi module to a product on the Bolt cloud. You do however need to make sure that the device is online.

Please clarify,

What exactly did you observe that made you believe that the controller.html is not working?

1 Like

Sir @vinayak.joshi when I open the controller.html file on the the browser after putting the api key and device id and clicking submit, the api key and device ud slot becomes empty if I fill the details again… same thing happens again and again

The code which I have uploaded on my arduino uno is this

#include <BoltIoT-Arduino-Helper.h>

# define left_motor1 6

# define left_motor2 7

# define right_motor1 8

# define right_motor2 9

# define sensor 3

String command = “”;
int delay_time = 250;

String check() {
int sensor_value = digitalRead(sensor);
Serial.println(sensor_value);
Serial.println(command);
if ((sensor_value == 0) && (command == “FORWARD”)) {
digitalWrite(left_motor2,LOW);
digitalWrite(left_motor1,LOW);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,LOW);
command = “”;
}
return “STOP”;
}

String forward(String *data) {
command = “FORWARD”;
digitalWrite(left_motor1,HIGH);
digitalWrite(left_motor2,LOW);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,HIGH);
return “Success:Forward”;
}

String backward(String *data) {
command = “BACKWARD”;
digitalWrite(left_motor1,LOW);
digitalWrite(left_motor2,HIGH);
digitalWrite(right_motor1,HIGH);
digitalWrite(right_motor2,LOW);
return “Success:Backward”;
}

String right(String *data) {
command = “RIGHT”;
digitalWrite(left_motor1,LOW);
digitalWrite(left_motor2,HIGH);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,HIGH);
delay(delay_time);
digitalWrite(left_motor2,LOW);
digitalWrite(left_motor1,LOW);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,LOW);
return “Success:Left”;
}

String left(String *data) {
command = “LEFT”;
digitalWrite(left_motor1,HIGH);
digitalWrite(left_motor2,LOW);
digitalWrite(right_motor1,HIGH);
digitalWrite(right_motor2,LOW);
delay(delay_time);
digitalWrite(left_motor2,LOW);
digitalWrite(left_motor1,LOW);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,LOW);
return “Success:Right”;
}

String stopcar(String *data) {
digitalWrite(left_motor2,LOW);
digitalWrite(left_motor1,LOW);
digitalWrite(right_motor1,LOW);
digitalWrite(right_motor2,LOW);
return “Success:Stop”;
}

void setup() {
// put your setup code here, to run once:
pinMode(left_motor1,OUTPUT);
pinMode(left_motor2,OUTPUT);
pinMode(right_motor1,OUTPUT);
pinMode(right_motor2,OUTPUT);
pinMode(sensor,INPUT);
boltiot.begin(Serial);
Serial.begin(9600);
boltiot.setCommandString(“FORWARD”,forward);
boltiot.setCommandString(“BACKWARD”,backward);
boltiot.setCommandString(“LEFT”,left);
boltiot.setCommandString(“RIGHT”,right);
boltiot.setCommandString(“STOP”,stopcar);
}

void loop() {
// put your main code here, to run repeatedly:
boltiot.handleCommand();
check();
}

And I am using 4 motors with this driver shield shown below

Pls tell me what is the error

Hi,

The issue is with the controller.js file that is supposed to be in the same folder as the controller.html file.

The behaviour that you mentioned (the api key and device id becoming blank on clicking submit) happens when you do not place the controller.js file next to the the controller.html file.

Place both the files in the same folder, then reload the controller.html file and the system will start working properly again.

Sir my hardware connections are has shown below

and the bolt wifi chip is connected to the arduino as given below
Tx -Rx
Rx-Tx

The wifi module is powered up using a charger adapter.
A 9v battery is used for arduino uno

The ir sensor is connected as shown in the circuit below
20201113_123702
The motors are working fine with connected to the motor driver along with batteries
But when I connect the arduino and run the controller.html file the motors aren’t working

What is the error. Pls help me @vinayak.joshi

Hi @erinepereira27,

Is your controller.html still hiding your API key and device id once you click on submit, or is that issue fixed?

Until the above issue is fixed, the controller.html file will never send any commands to your Bolt WiFi module.

2ndly, you said that you connected Tx-Rx pins of the Bolt WiFi module to the Arduino in a cross fashion. This is the correct thing to do. But did you connect the GND pin of the Bolt WiFi module to the GND pin of the Arduino? If you have not connected this, then you have an open circuit, which cannot transfer commands from the Bolt WiFi module to the Arduino.

Sir @vinayak.joshi
The controller.html file issue is solved … but the issue of motors not moving when connected to arduino is not solved even when the ground pin of wifi module is connected to ground pin of the arduino

Hi @erinepereira27,

Please reload controller.html,
then right click on the page, and select inspect.
Go to the console tab on and then try controlling the motors.
Once you have clicked on the buttons, take a screenshot of the console tab, and share it here.

@yeshwant.naik, can you check if this user’s API key has been rate limited?

@vinayak.joshi

Hi @erinepereira27,

This is fine.

How did you enter the device id?
For example if the Bolt Id is BOLT125215, did you enter 125215 or did you enter BOLT125215?

BOLT125215 i have entered @vinayak.joshi

Sir pls help me @vinayak.joshi I await your response

Hi @erinepereira27,

Ok, the next test to confirm is whether the arduino code is actually working properly.

Disconnect the Bolt WiFi module from the Arduino.
Connect the Arduino to your computer using the usb cable.
On the computer open the Arduino IDE and then go to tools>serialMonitor.
Set the baud rate to 9600, and send the command “FORWARD”, “BACKWARD”, “LEFT” and “RIGHT” via the serial monitor to your Arduino.
At the end of each command, check if robot does the actions.

Sir @vinayak.joshi
Only the wifi module needs to me disconnected??
Rest all connection remain same ?

Sir @vinayak.joshi the robot isn’t working , jus 0 are being shown on the screen…pls help

I uploaded the code again

@vinayak.joshi

Hi @erinepereira27,

So, the issue is not at the server side, or on the Bolt Side. The issue is now limited to the circuit and the Arduino code.

The code that you uploaded to the ARduino, it is the same code that was present in the zip file right?
Please share a screenshot of the serial monitor. Also, remember that the baud rate has to be set to 9600.

@vinayak.joshi

Also I am using a ir sensor …but in the original product proximity sensor is used…

So will there be any changes in the code ??? @vinayak.joshi

Hi @erinepereira27,

It seems there might be a code issue in the Arduino code.

Please change the following code in the loop function

check();

to

//check(); 

Upload the code to the Arduino/Boltduino and test the system.