Remotely control the MKR 1010

Hey everyone, I've finally been able to start using my MKR 1010 board. I'm thinking about using it to be my flight controller. I'm pretty new to wireless/http requests and things so I'm not sure exactly how to do it. My main goal is to get something on a little model plane that you can access from another computer and then fire events, i.e. turn a servo after pressing a button. I have no clue how to do this and I'm not sure if I should mount the 1010 on the plane itself or just have it as a ground controller. If I did have another computer on the plane what computer would it be. What are my best options in this case? Sorry for how vague this is and I'll understand if no one can answer this but all help is appreciated. Thanks!

Hello @anon40151205

This might help you: Link to a very basic tutorial about TCP (evolved to: TCP-socket democode to send / receive data / characters similar to serial

Note that the sample code in there was written for an ESP8266 not an MKR1010, it might need minor modifications to work. What you can achieve with the sample code is transferring data between 2 wifi connected boards using TCP. You can also use a terminal, for example PuTTY, to transfer data from your PC to / from your wifi connected board. I do not know if the examples in that tutorial are suitable for your current level of expertise.

I would think something like a D1 Mini would be more suitable to mount on an aircraft because it is smaller and lighter.

2 Likes

If this microcontroller is really controlling the plane in the sense of the only thing that controls the flight = an unmanned airial vehicle UAV you have to take care of a lot of things and have to obey a lot restrictions and formal qualifications and having payd for a special insurance.

Developping a flight-controller in the sense of remotely controlled flight for a plane I would highly recommend to use professional RC-equipment. Professional in the sense of professionally manufactured but designed for hobby use. If you are really keen on unmanned self-controlled driving do it with a car or a boat but not with a plane. A simple bug and a plane is crashing down and will be destroyed.

Any kind of bug in a model-car or model-ship. Car bumps against some object maybe flips over and thats it.

You can make driving the car a big challenge too:

  • find shortest way around obstacles
  • drive around creating a map of the obstacles
  • follow me whereever I go

best regards Stefan

2 Likes

Thanks I'll read more about this!

@PerryBebbington Alright after extensive reading I've figured out stuff about TCP/IP and OSI models as well as all the protocols. Just one more thing, I now know I have to connect the D1 Mini to a wifi which the MKR 1010 is also on, I would then get the IP of the D1 Mini. After that on the MKR 1010, I would establish a UDP/TCP connection on an empty port. Next, I could make a server object on the D1 Mini? After that, the MKR 1010 could have a Client (?) object on it. The MKR1010 would then initialize by requesting to begin communication etc. 3-way handshake done. After all that is done, I would be able to communicate by sending data from the MKR1010 client to the D1 Mini Server which could then execute things when it receives specific data. Alright finally after all that here are my questions: Should the server be on the D1 Mini or the MKR1010?, Should I use an empty port or do I choose an already used one? And finally what protocol do I use to send commands/text, i.e. SSH? HTTP? which is best.

Also one more thing I forgot that Random User was an alt that I needed to use since I lost my phone for a day.

Moderators cannot delete accounts.

Please send a request to privacy@arduino.cc and ask them to delete the account you don't want. You ard not allowed more than one account, having multiple accounts risks permanent suspension of all accounts.

I'm away from home until tomorrow evening, I'll attempt to help with your other questions when I am in front of my PC. Note that TCP communication is fairly new to me so I don't know all the answers.

Thank you.

1 Like

if you are still on how to remotely control a plane

building a system with a server and client both running on microcontrollers this will be wayyy too slow for controlling a plane.
In some cases it will take 2 to 4 seconds until the next command is transferred. And this is way too long.

If this should have a chance you should use a direct connection with ESP-NOW.
But there is another thing to consider:
range of the radio signal

Even if you use external antennas for Wemos D1 mini and MKR the range for a medium fast and reliable connection is limited to something around 50m. This is way too less for a plane.

If your interest is programming microcontrollers with WiFi / Servers / clients realise a project that is stationary

If you interest is cheap RC-flying go buy a used RTF set of a RC-flying beginner kit
The Apprentice S15E SAFE (not the STS-version) is the ultimate beginner RC-plane

Very very forgiving. Very stable in flight, unstallable.
Which I have flown in wind up to 40 mph. It has an electonic stability system called "SAFE"
Test der SAFE Technologie der Apprentice S - YouTube

best regards Stefan

1 Like

Alright I'll do that now

You need the IP address of whichever device is going to be the server, that device should have a static and known IP address. The preferred way to assign a static IP address is to configure the router to lock the IP address to the MAC address of the device so that DHCP always assigns that IP address to that device. How you do that depends on the router, follow the instructions for the router you have. If you do it this way then the router knows not to give that IP address to anything else. Duplicate IP addresses will cause all sorts of irritating and difficult to track down problems. The client device does not need (but can have if you like) a static IP address.

Pick a port that's not in use for something else, don't use any of the ones on this list: List of TCP and UDP port numbers - Wikipedia.

As to which device should be the client and which the server, for your application I don't know. I think I'd start with the controlled device (aircraft in this case) but I think you will have to experiment to see which is best for what you are doing.

As to whether TCP is even appropriate I agree with @StefanL38 , but that's not what you asked. I suggest that if you really want to use IP then UDP is more appropriate as it is a lot faster and more appropriate for 2 way real time applications (it is used for 2 way voice (telephony) and video conferencing for this reason). UDP sacrifices reliability in favour of speed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.