I just want control my DC engine, by using an WiFi technology. My finally idea is write an android apk, and controlling this device by using WiFi.
I wanna take a control of this :
I will put an wheel on it. I wanna take a control of speed and direction of this engine. To make my project easier, I just bought an L293D Motor Driver ( H-Bridge ).
I have a Arduino Leonardo. I've just connected all cables in this way :
The red one device is an converter of logic levels - to connect all cables in the fastest way.
The blue device is an module of WiFi ---> ESP-12E ESP8266
After connecting all of this cables ( including H-Bridge to give me opportunity to control of speed and direction ) I have no idea what to do later. I just want to be able control my engine, by using WiFi aplication on Android.
What should I start from ? Anyone can help me ? This is a programming difficulty right now for me.
Give me any links or write me what should I do right now.
How much coding experience do you have? If none, then this doesn't make a very good first project. You should work on some simpler stuff until you have a good grasp of the language.
If you do have lots of coding experience and know the language, then you need to ask more specific questions.
Then you're pretty sure, that project it's too hard for me ?
You're right - I don't have much codding experience. Just a simple programs by using C++ language. I was thinking that idea isn't too hard in realization. Try to give me a chance and help me with this issue ^^.
I'll be very grateful for some advices... What should I start from ?
sn00ker:
Then you're pretty sure, that project it's too hard for me ?
You're right - I don't have much codding experience. Just a simple programs by using C++ language. I was thinking that idea isn't too hard in realization. Try to give me a chance and help me with this issue ^^.
I'll be very grateful for some advices... What should I start from ?
"Where should I start from?" That implies that you have nothing going so far. That's a pretty sure fire indication this is over your head. Maybe not. But if it really isn't and you have even the slightest chance then you should be able to come up with a more specific question than, just show me how to do it. What step is giving you trouble? What have you tried so far?
Start by breaking this into lots of small projects. Can you write a simple sketch that works the motors through the motor driver? No wifi, no internet, no ESP8266, just the motors. Can you make them spin? Both ways?
Write a sketch to connect to the ESP8266. No motors, no android, nothing but the ESP8266. Can you make it work?
Can you send data from android to the ESP8266? Forget the motors for now, can you send a simple number?
That's what you've got to do. You've got to break this down into smaller projects so you can learn each of the parts. And you'll be able to ask better questions about those smaller projects and learn those things.
Delta_G:
"Where should I start from?" That implies that you have nothing going so far. That's a pretty sure fire indication this is over your head.
I agree. I made some "language mistakes" but it isn't a reason to disqualify my person I guess.
What is the most difficult step for me ? I have no idea how to connect it with an Android apk because I've never written anything on Android.
I forgot to say. Yes - I was able to spin motors in both ways. I had no problem to run wheels faster [ by giving a higher value to current ( range -> from 190mA to 250mA ) ]. Programming issue on Arduino it's not a problem. I got a lot of libraries or I'll write it mannually ( little bit slower ).
The problem starts, when I'm thinking about : " How I'll connect my finally Arduino project with an Android aplicaction? " I don't have any expierence on devices on Android platform.
I wasn't discounting you personally. Just saying that you weren't instilling much confidence with what you wrote. The more specific you get the closer I get to being able to help you.
Do you mean you've never written for android before? Go get android studio and work through some example codes. It's all in Java. Do you know any Java? It is very similar in syntax to C++ so it shouldn't be Ard to start to see it.
Once you can get a "Hello World" type android app running then you can move on to seeing if you can make it send data over the wifi.
So you don't know how to code for Arduino, and you don't know how to code for Android, and you want to do both?
There are plenty of tutorials you need to go through because trying to trick people into doing your project for you doesn't work.
When you connect a device with wi-fi, the end result is that your android has an IP address on your local network, and other devices on the local network can send and receive packets from it.
Every IP address has 32000 virtual "ports". When a device sends a packet, it sends it to "X port on Y ip address". To receive a packet, a device "listens" on a port. On a computer, different processes will be listening on different ports - webservers listen on port 80, for instance.
From the Android's POV, this means that you use the java.net library functions to either send self-contained packets of up to a few K (Unconnected Datagram Protocol - UDP), or you open a "stream" of packets (Transmission Control Protocol - TCP) . From the Arduino's point of view, you use an ethernet "client" object.
The content of what goes over the connection is up to you. You can just send C structs via UDP as a block of bytes - this is the simplest option. Routers and other network hardware may block this, but probably not if you are running on a local subnet.
Alternatively, you can use streams and have your arduino mimic the operation of a web server. Web servers implement HyperText Transfer Protocol - HTTP. Doing this means that you can talk to your arduino with chrome on your phone - no need to write an android app. This is such a common model that there are plenty of Arduino libraries for you to use to avoid coding the details of HTTP.
I wrote an app much like what you want to do, using bluetooth rather than wireless. The code for both the APK and the INO is here.
I'd advise going the HTTP route - writing android apps is a whole new world of complexity. The main benefit of the android app is that you can use bluetooth and not have an external network., but that's not what you are doing.