Go Down

Topic: Communicate with YUN using WIFI with Android phone (Read 18787 times) previous topic - next topic

Vadorequest

Nov 09, 2013, 02:21 pm Last Edit: Dec 18, 2013, 12:59 am by Vadorequest Reason: 1
Hi.

I have to build an Android application that has to find the YUN using WIFI and communicate with it.
The Arduino will control a car, the phone application will control the arduino.

It's my first time with Arduino and I don't know really how to do it.
I know the YUN can be used as hotspot, I'm wondering about that, do I have to list all detected devices? It's what I planned to do, list hotspots detected with Android and choose the good one for initialize the connection.

Once the connection is initialized I think I'll store in session required information (IP, port) to communicate with the Arduino after.
I think use a webservice on the Arduino that will describes services for move, turn, take pictures, and more.

The Arduino will have a camera onboard which will send to the phone pictures or live stream (depends on the camera possibilities), to have a photo on the android screen of the road.

If you could help me a bit, it would be nice! Don't hesitate to give me advices ;)
Thank you.

Edit: This project is well advanced now (18/12/2013) you can find all our documentation in our GIT repository: https://github.com/Vadorequest/AAD1, please see next page for more details.

federicofissore


Vadorequest

Okay, I'm reading right now, you're right, it's useful and interesting, I thought about use sockets before but I wasn't sure.

Thank you.

AllSystemGO

Hey Vadorequest,

   Let me know if you ever need some of my code I have no problem sharing with you. Maybe I could ask you some questions about the android part.

Send me PM if you ever want info.

Vadorequest


Hey Vadorequest,

   Let me know if you ever need some of my code I have no problem sharing with you. Maybe I could ask you some questions about the android part.

Send me PM if you ever want info.


Thanks!

I tried to send you a PM but I'm not sure it's working, I have nothing on my outbox.
So I post it here too, in case of.

Quote from: Vadorequest

Hi!

Thank you for proposing your help, your source code is really useful.

If you want to take a look to our project, this is the git repository:
https://github.com/Vadorequest/AAD1

You can find the Android application to control the car, the Arduino app is not here yet, but will be soon. (My teamates need to learn how use git ^^)

For the moment I use your source code for test my application but it's not working with sockets but it works with http web requests. (You can see both on the source code)

I'm wondering about the socket part, I prefer use sockets instead of http requests because it's better indeed.
The socket can connect but it looks like (arduino side) the command is not recognized. I tried several entries but no one worked actually. So the systems can communicate but not very well!

Could you take a look?
The stuff about socket is in the file CarActivity.java line 179 for instance. (Events)
The socket class is in job/carCommunication/

There is a class diagram in the folder /Design, could help a bit.

I learn today that we could be limited by the memory of the Arduino about the program, we will probably need more space to store it on the YUN, do you have ideas about this issue? (Write less code? :p)

Thank you for your help.

federicofissore

It seems like you both are doing pretty well! :) What about turning your projects into a Scuola tutorial?  (scuola means "school" in italian)

AllSystemGO

I don't mind doing the tutorial. Let me get everything working and for sure I'll create one. But I'm afraid my code isn't the most optimized code there is.

federicofissore

No problem. You're leaving "room for improvements". It makes the learning process challenging, in the good sense :)

Vadorequest

For the moment I'm fighting against socket and http request, trying to find the good code in Arduino and Android, the tutorial will come when I'll succeed ^^

Vadorequest

I succeed to use sockets after a lot of issues ^^

I can communicate between Android and Arduino even if I don't parse correctly the result yet.

AllSystemGO


Vadorequest

Finally, with a new Arduino (actually the third, we burned the second, putting 9V on it with the motor shield, because YUN don't have a regulator as the other Arduino, but we didn't know that) we are working on the project again.

I took a video a hosted it on youtube: https://www.youtube.com/watch?v=F-oRrcYfv8o
We worked on the documentation these last weeks, couldn't work on the arduino (I just got the new one) and it's on github!
https://github.com/Vadorequest/AAD1

I have a new problem but I'll create another topic about it. (parsing)

AllSystemGO

Congrats Vado. I'm almost done controlling my car using a joystick on android. I'll post you what I have when I'm done.

federicofissore


Vadorequest

Documentation will be fully available on the git soon, less than two weeks at worse.
About Android and Arduino, with documented source code and UML (4+1 view model) (class diagram, sequence, activity, and more!).

Should be helpful ;)
Maybe a document about what NOT to do ^^

Go Up