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.)
4 Answers 4
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.
-
\$\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– JonathonG2012年01月19日 05:14:46 +00:00Commented 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– milch2012年01月19日 05:17:24 +00:00Commented 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– JonathonG2012年01月19日 05:37:35 +00:00Commented 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– JonathonG2012年01月19日 05:54:28 +00:00Commented 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– milch2012年01月19日 14:03:47 +00:00Commented Jan 19, 2012 at 14:03
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.
-
\$\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– Lundin2014年08月06日 11:40:42 +00:00Commented Aug 6, 2014 at 11:40
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.
- NO
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.
-
\$\begingroup\$ what about RPI ? a complete single board computer? \$\endgroup\$Standard Sandun– Standard Sandun2013年03月29日 07:21:35 +00:00Commented 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\$Connor Wolf– Connor Wolf2013年03月29日 11:14:48 +00:00Commented 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\$Standard Sandun– Standard Sandun2013年03月29日 12:21:27 +00:00Commented Mar 29, 2013 at 12:21
-
\$\begingroup\$ @sandundhammika - Doh! You are completely correct. I heard rPi, and assumed linux. \$\endgroup\$Connor Wolf– Connor Wolf2013年03月29日 12:23:44 +00:00Commented Mar 29, 2013 at 12:23
This blog may be helpful. The wifi relay and iMatic controller is quite cool. However, I cannot make it work. :-(
-
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– PeterJ2014年08月06日 08:16:05 +00:00Commented Aug 6, 2014 at 8:16
1
if the sensor detects something or0
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\$