Notifications
Clear all

Problem with Geekcreit® UNO+WiFi R3 ATmega328P+ESP8266 32Mb Memory

67 Posts
6 Users
1 Likes
32.4 K Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @gulshan

yes, thank you but i still coudn't figure out how it works in the "ATmega328p-->>Esp8266" mode. I was trying to use the "Remote xy " app to control the arduino using esp8266 chip on board but it is not working.

I don't know how the Remote XY app works.    

But I do know that the "ATmega328p-->>Esp8266" communicate via the serial port.   So you would need to have a program uploaded into your ESP8266 chip that accepts the data from the Remote XY app, and then passes that data over to the UNO via the Serial port.    There are many ways you can do this.

This is how I'm doing it as well, except I'm not using the Remote XY app.   I have a program on my laptop that sends commands to the  ESP8266 chip via  the WiFi connection.   Then I have the ESP8266 chip forward that information over to the  Arduino via a  Serial port.

On the Arduino I simply have code that looks to see if there is any incoming serial messages from the ESP8266 chip.   If anything comes in, the Arduino  reads it and acts on it.

I also have two-way communication.   If the Arduino code needs to send a message back to my laptop it simply  sends that message to the ESP8266 chip, and the ESP8266 chip then sends the data back to the laptop via WiFi. 

So I have full two-way wireless communication between my Laptop computer and the Arduino.   The ESP8288 is simply the "middle man" that   relays the messages back and forth.   That's all the ESP8266 needs to do.   The Laptop computer and the  Arduino are doing all the actual functions.  The ESP8266 is just being used for its WiFi capabilities. 

I'm also  using UDP instead of TCP for the WiFi communication because it's a lot simpler.

I'm looking forward to using these new boards.  I'm glad you brought them to my attention.  I've been using a separate ESP8266 module on a prototyping shield on the Mega.   But now with these new mega+ESP boards I won't need to use the shield anymore.   It will all be built into the single board.  That makes it a lot neater.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Gulshan
(@gulshan)
Member
Joined: 5 years ago
Posts: 127
Topic starter  

@robo-pi

Can you give me an example of such code through which I can communicate with the arduino through esp8266 from Android phone ?


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @gulshan

Can you give me an example of such code through which I can communicate with the arduino through esp8266 from Android phone ?

I don't have an Android phone and I don't know how to program Android devices.

I do have an Amazon Fire tablet though and I would like to learn how to program it.  But I don't know if that would be the same as Android?  I'll have to look into it.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 
Posted by: @robo-pi

I do have an Amazon Fire tablet though and I would like to learn how to program it.  But I don't know if that would be the same as Android

Yup. The fire tablet runs on Android, although, you have to do a bit of tweaking to get it to run your own programs or get apps from Google's Play Store cuz Amazon likes to keep you trapped in their own little Amazonian world

It's not too much effort tho, I did it on mine

MIT has a nice simple GUI based programmer for APK's which I've used successfully on a few occasions 

 
 

   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @spyder

Yup. The fire tablet runs on Android

How do you know about so much about everything?   Some people are just in a category of their own I guess.

Anyway, thanks for the heads-up.     I'll look into it and see if I can run my robot program on my Fire tablet.   If I'm able to do that I'll post the resulting code.    I'll just leave my esp8266 code the way it currently is and see if I can send the proper data to it using Android on the Fire tablet.   This is something I've been wanting to do anyway just to try it out.  They say that learning how to create Android apps is worth learning anyway. 

Posted by: @spyder

although, you have to do a bit of tweaking to get it to run your own programs or get apps from Google's Play Store cuz Amazon likes to keep you trapped in their own little Amazonian world

It's not too much effort tho, I did it on mine

I may need to pick your brain a bit later on the tweaking tricks.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 
Posted by: @robo-pi

How do you know about so much about everything?

HA ! Obviously, I don't. A little about a lot maybe. Otherwise I wouldn't be having such a problem with this ROS thingy

As to how, sell your TV. It rots the brain. I haven't used one in almost 20 years. Sports and Dancing with the Stars is why the public is so stupid and easily manipulated.

Just Google "Honey Booboo" and you'll learn all you need to know about why TV is useless

I have a TV, but I use it as a monitor. Lots of google and youtube instructables out there that are much more interesting than watching people I don't know voting on dance moves I don't understand to music I've never heard of

Posted by: @robo-pi

I'll look into it and see if I can run my robot program on my Fire tablet.

My own controller program for my Otto Bot uses bluetooth (works on both my Amazon Fire and my Android phone), and I haven't tried to adapt it to WiFi. Although, I made it before the ESP32 came out. I'm not sure if I would've gone with WiFi or BT if it had been an option at the time. The ESP32 is a little more powerful as well as having more built-in options

For a robot as versatile as yours is going to be, I'd want to think about how many GPIO's I have available cuz otherwise you might end up trying to connect to multiple addresses... although, now that I think about it, a web page might be a way to integrate multiple address connections if you were to use WiFi instead of BT


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 
Posted by: @robo-pi

I'll look into it and see if I can run my robot program on my Fire tablet.

How is it written ? What language ? What type of interface ?


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @spyder

For a robot as versatile as yours is going to be,

The final version of my robot won't be using this esp8266 chip.  I'm only using this now for prototyping.  Eventually I'll be moving over to using the Raspberry Pi for the main interface.  Like Bill's DB1 project I'll still be using the Arduino Mega for the motor functions, but that will eventually be getting its commands from the RPi instead of from the esp8266 chip.

So this is all just for prototyping right now.  It's just a quick and easy way to connect it to my laptop so I can develop programs easier.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

@robo-pi

Okay, this is gonna be "stream of consciousness, so it might get confusing... esp8266 is gonna be arduino. Arduino Mega is also gonna be arduino. Good for autonomy, but, arduinos are pretty stupid as far as brains are concerned, so it's gonna need input... Sensors and cameras maybe. Still dumb inputs. It won't be making any choices on its own. Still gonna need some kind of "direction" (not as in left/right, but, as in "do". Action items)

Still needs a human facing interface. 8266 has no BT, so it's gonna be WiFi.

Okay. I got it. It's a pain (if you wanna use the Fire) but it's doable. I've installed ArduinoDroid on mine. It works, it's not a great option, but it does work. and I've also got "connectbot" (which is ssh. Also a pain, as the "enter" button seems to be an issue. I have to use the BT keyboard I've got. And you have to remember to stop it from going to sleep while yer working, or remember to save every 10 seconds. The ssh keeps the connection, but the arduino loses yer program, which totally sucks

Here's what the Arduino looks like on the Fire...

arduinofire

And here's what it looks like with the keyboard and the case...

arduinofirewkb

(you really want a keyboard)

Yer gonna want to get one of those OTG USB adapter cables with a couple of USB ports (USB hub thing) on it that they sell for the Raspberry Pi Zero so you can connect the arduino boards to it

I bought a case thing for my Fire with a magnetic closure and a magnetic BT keyboard stuck inside, so when you open it, the keyboard is right there. Pretty nice actually. I think I paid something like $25 for it. Maybe less. I can't remember. It works tho. And you've also got a web browser on the Fire, so if you wanna use a web interface, that's probably yer best option, or maybe a gaming joystick, which yer gonna wanna have if you build the Jetbot (which is a pretty cool toy, as well as a learning experience)

After that, yea, it's gonna have to be a web page or a joystick. I found one for a web page called "thunder" (or something) that I was gonna use at some point. Lemme see if I can find it...

Weird. I could've sworn it was called thunder

And, of course, it still needs a connection to that web page. Let's see...

Ah, here we go... 

Yea, I think yer gonna like that one

And here's one for Pi controlled web interface

Okay, so, to install stuff on the Fire, yer gonna first want to go to "settings", "privacy & security", and "allow apps from unknown sources"

Easy, right ?

It'd, of course, be nice if you had an SD Card in the Fire before you started doing all this (I probably should've said that first), and another nifty program to have is something to "install to SD". I can't remember what it's called, but if you search for those words you should find it.

Not all programs can be installed to SD

So don't worry if some program denies that option. The Arduino is one that CAN'T be installed to SD

Then you want a program called "esfile explorer". It's just like the name says, a file explorer

Create a folder on your Fire (using esfile explorer, preferably on the SD Card. This becomes handy if you wanna copy stuff over from your PC) to save the .apk files in

Then, to get the Play Store, you have to download, then install the .apk file. That's how android apps are written, in .apk extension

So here's the page for the Play Store .apk

(Make sure you pick the right one for your version of the Fire)

Then find the file you just downloaded (and hopefully put into the apk folder) and install it (again, with esfile explorer)

After that, you no longer have to deal with .apk files (for the most part. If you start writing your own, obviously, you'll be writing them in .apk) and you can just go to the Google Play Store (via the icon you just added to your "desktop" by installing it) and install pretty much anything you can find there

VNC is another thing you'll probably want. And QPython3 for editing python is also very handy. Also MagicDOSBox can come in handy at times. It's just a DOS interface, but, I find it occasionally useful

Oh, wait. I forgot one... "My Phone Explorer" client, which also needs to be installed on your computer to connect your tablet to your PC

So...

ESFile Explorer

Play Store

Install To SD

connectbot

VNC

ArduinoDroid

QPython3

MagicDOSBox

My Phone Explorer

There. That should keep you busy for about 2 hours and make yer Amazon Fire Tablet really useful

Hope this helps 🙂

 

 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

@spyder,

You're talking away over my head.  I can't even get started here.

All I want to do to begin with is write a simple "Hello World" program on the Table using the App Inventor.

But I have no clue how to even do that much.

I followed the instructions on the MIT webpage.

I'm trying to use Option 1: "Building apps with an Android device and WiFi"

I booted up my Fire Tablet and downloaded the MIT AI2 program on the Fire.    So then when I go to run it I get a start up screen that asks me to type in a  6-character code but I have no idea what the code is.  The instructions tell me that I'll be able to find the code on my computer.   But they never told me to download anything on my computer.  So I  have no clue how to even get past this start-up screen.

What am I supposed to be connecting to?  My PC?

According to their picture that's what I'm supposed to be connecting to:

Was I supposed to have some special software installed on my computer?  The instructions didn't say anything about that.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

Ok scratch my last post.  I figured it out.  I had to create an app on the MIT AI2 website first and then I was given a code to connect.   So I'm connected to my computer for writing Android apps now.  I should be all set from here.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

I did it!   I wrote my first Android "Hello World" app. ? 

I even made it speak "Hello world".

So now all I need to do is figure out how to send text characters via UDP packets to the esp8266 chip.

Wish me luck!  I'll bet this won't be as easy as the Hello World app. ? 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

WOW!   I did it!  ? 

The original App Inventor didn't have UDP capabilities.   But I was able to search around on the Internet and  I found a UDP extension for the App Inventor.   Once I did that writing the program was a piece of cake.

So far all I've done was write a single button to test the connection.  But so far it works.   Now I'll write up a slightly more complete version with forward, backward, turn right and turn left buttons.     This shouldn't take too long.

This will just be one-way communication for now.   Just sending commands to the robot.

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

Ok the Tablet is programmed using Android.  It just sends out four simple commands to the robot telling it to move forward, reverse, right, or left.   I also added speech to it since it was so simple.  So the phone, or tablet will tell you what it's doing when a button is pressed.

Here's what it looks like on the phone or tablet:  I didn't do anything fancy.  Just four control buttons.

Phone

Here's the four code blocks for each button

Move the robot forward:

blocks 1

Move the robot in reverse

blocks 2

Turn Right

blocks 3

Turn Left

blocks 4

Of course this assumes you already have a robot that has an esp8266 module programmed to accept these commands and send them over to the Arduino to control the robot motors.

This is all done with UDP.   The IP address is the IP address my esp8266 modules has been programmed to use.   Same with the port number.  Broadcast is simply set to True.  And timeout is set to zero.   This all works for me.

The text message is the actual commands.

I'm using the first letter as the command. F = Forward, B = Reverse or (Backward), R = Turn Right, L = Turn Left.

The three digits after the command letters tell the robot how long to travel in those states.   That number can be anywhere from 0 to 999.  I just used 50 for this quick and dirty program.

You could  set up text boxes on the phone to include the full commands before sending them over to the robot.

I'm not planning on using my tablet to control my robot.  I just did this to learn how to program Android phones.    Piece of cake! ? 

Thanks to @gulshan for pushing me over the edge into learning how to program Android phones.   With the MIT App Inventor it's pretty darn simple.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Spyder
(@spyder)
Member
Joined: 5 years ago
Posts: 846
 

@robo-pi

Sorry. I was in my lab burning my fingers off

Congratulations on your test run !!

I guess I should've been a little more specific. Yes, you got it right. The MIT App Inventor writes Android apps, and your tablet runs Android apps

The thing is, what you're doing now (from your description) is just test running the app, live, as you write it

What you really wanna do is, when you're finished with the app, create the .apk file (that's the "build" button at the top of the screen), and download it into the Tablet, then install it using the ESFile Explorer, so it's always there, and it "should" create an icon on your desktop, so you can then run it without having to link it to your computer, and at that point, you've got a nifty little remote control thingy now

Cool, eh ?

NOTE: You can also save it as an .aia file, which is an editable version of the app, which can then be sent to other people who also have the App Inventor, so that they can also edit it


   
ReplyQuote
Page 2 / 5