Author Topic: Arduino Uno will be enough to compute sliding mode controller algorithm ?  (Read 2279 times)

0 Members and 1 Guest are viewing this topic.

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
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 !
« Last Edit: November 25, 2019, 05:42:12 am by ammjy »
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4768
  • Country: nz
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #1 on: November 25, 2019, 08:27:36 am »
It would help if you can specify

1) 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?
 
The following users thanked this post: ammjy

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4364
  • Country: gb
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #2 on: November 25, 2019, 08:47:31 am »
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.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 
The following users thanked this post: ammjy

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4768
  • Country: nz
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #3 on: November 25, 2019, 09:06:12 am »
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.
 
The following users thanked this post: ammjy

Offline paulca

  • Super Contributor
  • ***
  • Posts: 4364
  • Country: gb
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #4 on: November 25, 2019, 09:13:22 am »
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.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 
The following users thanked this post: ammjy

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4768
  • Country: nz
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #5 on: November 25, 2019, 09:28:37 am »
I checked power consumption.

Arduino Mega2650 @16 MHz: 0.43 W
Teensy 4.0 @ 600 MHz: 0.53 W

Both 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...
 
The following users thanked this post: ammjy

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 4135
  • Country: 00
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #6 on: November 25, 2019, 11:06:46 am »
I recommend to use STM32 boards
 
The following users thanked this post: ammjy

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #7 on: November 25, 2019, 11:16:04 am »
For landing on Mars purposes ;D I 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.

« Last Edit: November 25, 2019, 11:21:09 am by imo »
Readers discretion is advised..
 
The following users thanked this post: ammjy

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: us
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #8 on: November 25, 2019, 11:04:28 pm »
Consider the Teensy 4.0

It 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
 
The following users thanked this post: ammjy

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #9 on: November 28, 2019, 08:49:18 am »
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 :)
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #10 on: November 28, 2019, 08:51:17 am »
Thanks you for introduce new nice product, Mr. Rstofer !
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #11 on: November 28, 2019, 08:54:50 am »
Thanks you for your advise, Mr. Imo :)

ahaha yes you are right :) FPU was your very important advise.
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #12 on: November 28, 2019, 08:58:53 am »
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.  :o
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: Arduino Uno will be enough to compute sliding mode controller algorithm ?
« Reply #13 on: November 28, 2019, 09:00:42 am »
Thanks you for your advice, Mr, Paul :)

yes, 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 :)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf