2 dc motors controlled through Arduino WiFi Shield

Hi,

I am new in Arduino and I am trying to complete a project. I would like to control 2 dc motors through internet browser using the Arduino WiFi Shield. The movements that I would like to do is forward, right, left, stop, and reverse. I used the example WiFi Web Server LED Blink with the L9 led that blinks through the browser and I put some extra things to control the motors. The problem is that when I am trying to blink the led everything working properly but when I run the new file there is a message in the serial monitor that client is disconnected and in the browser there is an error message. If I reload the page 3-4 times the buttons showed up but they aren’t working.

Any ideas?

I have attached you the code that I use…

WebServer_2Motors.ino (9.29 KB)

If you are powering the motors from the arduino, that will crash the arduino.

Zoomkat thank you for your reply.

I am using the dc motors that there is in the starter pack of arduino. Should I powered them with different batteries despite the fact that they are small motors?

I am so desperate because I trying to find out what’s the problem and every example in the internet is for the ethernet shield and I don’t know how to “translate” it in the WiFi shield.

Should I powered them with different batteries despite the fact that they are small motors?

Only if you want them to work.

I am so desperate because I trying to find out what's the problem and every example in the internet is for the ethernet shield and I don't know how to "translate" it in the WiFi shield.

What is there to translate? A GET request to an Arduino with an Ethernet shield looks EXACTLY like a GET request to an Arduino with a WiFi shield.

PaulS thank you for your reply.

As about the motors I get it!! As about the Get request I cannot figure it out..Sorry if I cannot understand something obvious for someone who has experience but I used the simple web server example and I tried to fill in my code to control the motors but when I was trying to run it, I connected to the WiFi network but the page cannot be display and a message "No data received". Despite the fact that when I am trying to run the simple server everything runs perfect.

Thank you.

We need to see the code that works, and the code that doesn't.

We need to know what the client is sending to the Arduino-as-server.

Thank you for your reply.

That is my problem, that my code doesn't work!!

I took the code from the Arduino examples, and specific the Simple WiFi Web Server(it works perfectly..)and I added the code for the motors.

Any ideas guys?

Thanks...

I took the code from the Arduino examples, and specific the Simple WiFi Web Server(it works perfectly..)and I added the code for the motors.

Perhaps you should post that code. :roll_eyes:

Thanks for your reply.

I have uploaded the code that works(Simple Web Server Example) and then the code that doesn’t (Simple Web Server My Code). If you can find what is the problem or fix the problem I will be grateful.

Thank you again and sorry if I bother you…

SimpleWebServer_Example.ino (4.78 KB)

SimpleWebServer_MyCode.ino (8.97 KB)

UPDATE

I tried the schematic attached below and I have also attached the code (ChangeDirectionExample file) that I have used for the motors’ movement and it worked without using the WiFi shield.

Afterwards, I put the WiFi Shield and I added only the forward function from the above code to the simple WiFi Web Server example code, it worked fine (Teliko file). However, when I added more functions (that is the whole code), the code is uploaded and connected to the network but when try to access the web page, I get back “No data received” ERR_EMPTY_RESPONSE. I have a print screen attached.

That is weird because at first it was working fine. I tried to add again only one function and I still get the same error.

Do you have any idea why? Could it be the static ip? I tried to do the WiFi.config(ip) but still nothing.

Any ideas guys?

Thank you!

ChangeDirectionExample.ino (1.47 KB)

Teliko.ino (7.22 KB)