2
\$\begingroup\$

I'm building a simple motorized vehicle that I wish to make autonomous through the use of neural networks. I am using Arduino as I am new to electronics but more experienced in programming. I'm sure there are much more powerful microcontrollers out there, but for my purposes (and funds) an Arduino Mega 2560 is what I would prefer to use (and I already have one). Now I suspect that the Mega, even though it is far more capable than an Uno or similarly small Arduino boards, is not capable of running a neural network that take inputs from a decently numbered array of sensors and generates several outputs (maybe 5?).

My idea, then, is to run the neural network on my phone if it is fast enough, or my desktop computer if not. Either way, I figured the best way to transmit the input and output data back and forth between the external processing unit (phone/desktop) and the Arduino will be WiFi. I saw a YouTube video of someone controlling an RC car with an android app they created, transmitting data through WiFi, and while a bit laggy for RC purposes, it seemed to be within 1 second of latency.

Does anyone know if WiFi would be fast/reliable enough to control a little autonomous vehicle? Assume that it will be traveling about the pace of an adult human walking, and reacting to its surroundings based on sonar sweeping. (Latency of data transmission will be important because the sonar data will have to be processed by the computer, but ideally the robot will keep moving without slowing down or stopping to wait for the data.)

\$\endgroup\$
10
  • \$\begingroup\$ There is one really messy point here. On a microcontroller writing optimized code really matters still. To fully optimize you really even have to know what your assembler is coming out as(I have had to to speed things up on a budget restrained system before) and it is no fun. \$\endgroup\$
    – Kortuk
    Commented Jan 19, 2012 at 4:51
  • \$\begingroup\$ I'm confused, the microcontroller would only be processing specific instructions such as writing a new PWM to a servo or motor, as well as sending the input from its sensors to the external advice, it would actually be doing very little processing itself. I understand optimization is still important, but that doesn't change the fact that an overwhelming majority of the processing is going to be done on something with multiple 3GHZ cores and a very large amount of RAM, unless I am failing to understand something. \$\endgroup\$
    – JonathonG
    Commented Jan 19, 2012 at 5:04
  • \$\begingroup\$ I was actually just giving some input on " is not capable of running a neural network that take inputs from a decently numbered array of sensors and generates several outputs" From some reason I read that without the not. I thought the rest was your counter-plan. I think you could get a neural network of a basic level work with the controller itself, it is all a game of how complex the inputs are, if you are talking about an almost bitmap of data, never. If you are talking about 64 inputs and 5 outputs, maybe. \$\endgroup\$
    – Kortuk
    Commented Jan 19, 2012 at 5:14
  • \$\begingroup\$ Ah I see, thank you for clarifying. I plan to start the project with relatively few inputs, designed in a modular way to allow me to add in more inputs in the future. However, to begin with there will probably be about 4 or 5 inputs, but they will all be contrived through algorithms of their own, only a couple of the inputs will be as simple as 1 if the sensor detects something or 0 if it doesnt. The rest will have to be calculated based on the sensory data before it can be passed into the neural network. \$\endgroup\$
    – JonathonG
    Commented Jan 19, 2012 at 5:23
  • 1
    \$\begingroup\$ One option, instead of the Arduino, would be the ChipKIT. This uses a 32-bit PIC microcontroller (MIPS based) that gives it a huge amount more power than the Arduino. Programming it is pretty much the same. \$\endgroup\$
    – Majenko
    Commented Jan 19, 2012 at 11:03

4 Answers 4

3
\$\begingroup\$

Yes, this IS possible. There are even people who control their Quadrocopters with WiFi, but the latency really is a problem. this thing is a commercial product and they let the user control it with wifi, but they have a huge load on algorithms on board to make it controllable. in your application I would never use WiFi but 433MHz/868MHz you can buy modules for around 5€ - called RFM12 (from hoperf). there is a huge load of librarys for these in the internet. Small tip: don't do all the processing on the one big host, the delay takes longer than the processing on board.

\$\endgroup\$
5
  • \$\begingroup\$ So, what do you mean don't do all the processing on the one big host? Are you suggesting that the Arduino Mega is capable of handling such a feat as I've described, or are you suggesting that I find a way to separate the tasks that it must perform, and process the most time-sensitive ones on board, with everything else being done through the wireless? \$\endgroup\$
    – JonathonG
    Commented Jan 19, 2012 at 5:14
  • 1
    \$\begingroup\$ well, you do, for example, do the collusion detection on board, but drawing a map or whatever else you want to do on the host. everything time critical must be done on the Arduino (the uno is just fine for collusion detection, no need for the Mega) \$\endgroup\$
    – milch
    Commented Jan 19, 2012 at 5:17
  • \$\begingroup\$ This was a great suggestion, thank you. For some reason I got it in my head that it all needs to be done on the big computer or the board itself, but no splitting the load between the two. \$\endgroup\$
    – JonathonG
    Commented Jan 19, 2012 at 5:37
  • \$\begingroup\$ How would you suggest going about interfacing the RFM12 to communicate with my cell phone or computer? All I can think of is using another MCU with a second RFM12 plugged in via USB to my computer, acting simply as a transceiver and doing no processing itself. Is there a better way to go about it? \$\endgroup\$
    – JonathonG
    Commented Jan 19, 2012 at 5:54
  • \$\begingroup\$ nope, no better way. that is exactly what I would suggest. The only thing I could think of is not to use a Arduino on the computer to interface the RFM12 but a TI Launchpad or some self build AVR board (for example on a breadboard) to lower the costs. \$\endgroup\$
    – milch
    Commented Jan 19, 2012 at 14:03
1
\$\begingroup\$

Consider using multiple micro controllers to delegate some calculations. If you've got multiple layers in your network you could chain multiple processors together. I highly recommend the paralax propellor running at up to 80mhz has multiple cores is 32 bit. It's pretty easy to program. The complexity increases dramatically when a. Using multiple processors and b. using a multi-core processor but you'll have no trouble with crunching data for a network and still be able to keep processing on the vehicle.

\$\endgroup\$
1
  • \$\begingroup\$ I doubt the processing power is the problem here. The question is rather if wifi is a realiable wireless media for real-time applications. \$\endgroup\$
    – Lundin
    Commented Aug 6, 2014 at 11:40
1
\$\begingroup\$

You're asking a few things here:

  • Is the arduino capable of reading several sensors/updating several control outputs fast enough for managing a vehicle?

    • Absolutely. It should be pretty trivial to manage ~1-10 inputs and 1-5 outputs 100+ times per second.
    • Note: This depends somewhat on the sensors feeding the inputs. If you have cameras, or any other devices which produce lots of data, an arduino is not the proper tool. It's probably better to think of, for example, a 640px * 480px camera as 307,200 (e.g. 640 * 480) separate single sensors. That will give you a better idea of the update rates you may achieve, at least without heavy optimization.
      A similar rule should be applied for any sensor that returns more then one value.
  • Is WiFI a reasonable idea for low-latency communication.

    • NO
      • The commercial products that use wifi for remote control usually only do so because they're designed to interoperate with commodity devices (tablets, phones, etc...). WiFi is actually pretty terrible from a latency perspective. It certainly is possible, but if you do want to use wifi, you need to realize you're really doing two projects. Your neural-net thing, and writing a predictive communication layer for wifi that tries to hide the latency as much as possible.
    • Personally, I would seek to only do one complicated project at a time.
    • If you can, use USB for connectivity. It's pretty bulletproof.
    • If you really need wireless connectivity, the XBee wireless modules are very nice. You get a decent amount of bandwidth, and most of the complexity of the actual wireless layer is fairly effectively hidden from you. The modules handle error-retransmission, checksumming, etc... silently, so you don't need to worry about them.
    • The RFM12 modules are also nice, but they're not quite as plug-and-play as the XBee modules. Again, I would seek to minimize (exposed) hardware complexity as much as possible (XBees are very complex, but they come as a complete module, so you don't need to worry about that complexity, at least initially), particularly since you're not too experienced with hardware.

Don't be dissuaded by the fact that the arduino seems "slow". Things like the ChipKIT do have a lot more processing power, but for many things, the ATmega is plenty fast. 16 Mhz is 16 MIPS. If you need to manage 100 updates/second, that's 160000 instruction cycles per update. You can get a lot done in that.

\$\endgroup\$
4
  • \$\begingroup\$ what about RPI ? a complete single board computer? \$\endgroup\$ Commented Mar 29, 2013 at 7:21
  • \$\begingroup\$ The rPi is an option. However, you need to remember that linux is not a real-time OS. As such, if you're talking to any device that has to have regular updates, you cannot guarantee this will happen on linux. \$\endgroup\$ Commented Mar 29, 2013 at 11:14
  • \$\begingroup\$ so it's a question of whether you could or could not run a good RTOS in RPI hardware right? \$\endgroup\$ Commented Mar 29, 2013 at 12:21
  • \$\begingroup\$ @sandundhammika - Doh! You are completely correct. I heard rPi, and assumed linux. \$\endgroup\$ Commented Mar 29, 2013 at 12:23
0
\$\begingroup\$

This blog may be helpful. The wifi relay and iMatic controller is quite cool. However, I cannot make it work. :-(

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Please add a few more details from the blog. At the moment it's pretty much a link-only answer and they are discouraged because they become useless if the link dies. \$\endgroup\$
    – PeterJ
    Commented Aug 6, 2014 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.