Arduino Uno will be enough to compute sliding mode controller algorithm ? - Page 1
Forum section: electronics / beginners

author: ammjy
author_rank: Regular Contributor
timestamp: November 25, 2019, 05:37:57 am
content: Hello, EEVBlog Users ! Always thanks you for your help.Thanks you for your time.Now, I am thinking Arduino Uno for my quadcopter control board.and I want implement sliding mode controller for my quadcopter.But, I am not sure that compute ability of Arduino Uno (exactly ATmega328P) can perform the compute of sliding mode control algorithm.most easy way to know is test by my self but, still I am building my own quadcopter so, I need a some advise to consider it.Might be, ATmega328P has not enough performance to implement nonlinear control algorithm include processing sensor's data ?Please, let me know !

author: brucehoult
author_rank: Super Contributor
timestamp: November 25, 2019, 08:27:36 am
content: It would help if you can specify1) how much data storage is needed. (328 has 2 KB)2) does it involve integer or fixed point or floating point calculations?3) how many calculations per second?

author: paulca
author_rank: Super Contributor
timestamp: November 25, 2019, 08:47:31 am
content: Just remember the Arduino eco-system now extends beyond the arduino. There are other semi-compatible MCUs available with the same ease of use through the IDE.Consider the ESP8266 runs at at least 60Mhz and has 1Mb of flash, plus much more memory, more PWM, more serial, more GPIO and Wifi.

author: brucehoult
author_rank: Super Contributor
timestamp: November 25, 2019, 09:06:12 am
content: I just made a really really quick micro-survey of flight controller literature and a few projects on github.Seems SMC is only very marginally more complex than PID. The programs I looked at had something like 15 floating point values in the state and just a few dozen FP ops in each control cycle -- let's call it 100. Seems as if control cycles are run at 100 - 200 Hz. So you need on the order of 20,000 FLOPs, maximum.A 16 MHz AVR with the standard Arduino FP libraries does around 100,000 FLOPs.A lot of people seem to have moved on to ARM based boards. And then they write the software in freaking interpreted Python. Lol.An Uno would seem to be a silly board to put on a quad. It's pretty big and heavy. You can get AVRs on much smaller boards. You can get *ARM* on much smaller boards.Here's a photo I found on google of an Arduino Uno vs an older Teensy (looks like Teensy LC 48 MHz ARM Cortex M0)The first Teensy's were AVR also. The latest Teensy 4.0 has a 600 MHz ARM with FPU and 1 MB RAM and it costs $20. It's really hard to see why you *wouldn't* use one if you need any kind of processing power at all. Even if you don't need speed, 1024 KB of RAM let's you run much more complex software than 2 KB of RAM.

author: paulca
author_rank: Super Contributor
timestamp: November 25, 2019, 09:13:22 am
content: Also, don't forget you'll need sensor, control and possibly telemetry interfaces as well. Whatever ADCs, PWMs or buses they use will have interrupts to serve which have timing considerations.

author: brucehoult
author_rank: Super Contributor
timestamp: November 25, 2019, 09:28:37 am
content: I checked power consumption.Arduino Mega2650 @16 MHz: 0.43 WTeensy 4.0 @ 600 MHz: 0.53 WBoth were running my prime number search code when I measured them :-) The Teensy runs that 300x faster than the AVR.So, yeah, power consumption isn't a reason to stick with AVR. In fact as the AVR will be working at a significant fraction of its capacity in this application, but you could probably put the ARM into a sleep mode 99% of the time, the ARM could use a lot *less* power.If that's even a consideration on a machine using 100+ W to power the rotors...

author: radiolistener
author_rank: Super Contributor
timestamp: November 25, 2019, 11:06:46 am
content: I recommend to use STM32 boards

author: iMo
author_rank: Super Contributor
timestamp: November 25, 2019, 11:16:04 am
content: For landing on Mars purposesI would recommend an MCU with double precision FPU..You do all the PID/etc. and navigation in double (15digits against 6-7digits in single precision), that saves you a lot of troubles.

author: rstofer
author_rank: Super Contributor
timestamp: November 25, 2019, 11:04:28 pm
content: Consider the Teensy 4.0It runs at 600 MHz, has 64 bit hardware floating point, over a megabyte of flash and a megabyte of RAM and it can use the Arduino infrastructure and the ARM M7 libraries are very nearly as complete as the ARduino offerings. So, the code ports!https://www.pjrc.com/store/teensy40.html

author: ammjy
author_rank: Regular Contributor
timestamp: November 28, 2019, 08:49:18 am
content: I appreciate for your advise, Mr, Brucehoult !I totally understood your point :-) Thanks you.I got many idea from you.and Teensy 4.0 is looks so nice board

author: ammjy
author_rank: Regular Contributor
timestamp: November 28, 2019, 08:51:17 am
content: Thanks you for introduce new nice product, Mr. Rstofer !

author: ammjy
author_rank: Regular Contributor
timestamp: November 28, 2019, 08:54:50 am
content: Thanks you for your advise, Mr. Imoahaha yes you are rightFPU was your very important advise.

author: ammjy
author_rank: Regular Contributor
timestamp: November 28, 2019, 08:58:53 am
content: Thanks you, Mr. Radiolistener.yes, I think so too stm32 is good base. But, I don't belive my programming ability.. haha.Maybe If I choice stm32, it will take more lot of times than Arduino to build system.

author: ammjy
author_rank: Regular Contributor
timestamp: November 28, 2019, 09:00:42 am
content: Thanks you for your advice, Mr, Paulyes, totally you are right,, might be actually that will be most hard part during build system on the board to me.Thanks you. you gave to me important advice