Author Topic: Raspberry Pi Or Arduino  (Read 4177 times)

0 Members and 1 Guest are viewing this topic.

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Raspberry Pi Or Arduino
« on: October 03, 2018, 06:15:06 pm »
OK, deep breath because the flame wars here could be spectacular.

I want to build a project that has a small computing requirement including reading a number of eight bit ports and outputting to a text based VFD display after some calculation. The CPU board needs to be 32-bit as I will be handling some large numbers and whatever processor I pick I will need to learn from scratch again as (up to now) I have been using PICAXE. System I/O through a USB port will be required.

So, Arduino or Raspberry Pi, and please explain your answer  :popcorn:
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: Raspberry Pi Or Arduino
« Reply #1 on: October 03, 2018, 06:28:29 pm »
Do you want to write C against the bare hardware (Arduino), or do you want to use higher level languages under an operating system (Pi)?

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Raspberry Pi Or Arduino
« Reply #2 on: October 03, 2018, 07:15:13 pm »
OK, deep breath because the flame wars here could be spectacular.

I want to build a project that has a small computing requirement including reading a number of eight bit ports

Not sure what an 8-bit port is, are these discrete IOs?

Quote
and outputting to a text based VFD display after some calculation.

What is the display interface? SPI, I2C, Ethernet??

What calculations? How fast?

Quote
The CPU board needs to be 32-bit as I will be handling some large numbers

Even 8 bit Arduinos can handle 64 bit values...depends on many Flops you need.
 
Quote
and whatever processor I pick I will need to learn from scratch again as (up to now) I have been using PICAXE. System I/O through a USB port will be required.
USB host or device? What device class?

Quote
So, Arduino or Raspberry Pi, and please explain your answer  :popcorn:

Insufficient data...but sounds like it can be done with an Arduino.
Bob
"All you said is just a bunch of opinions."
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Raspberry Pi Or Arduino
« Reply #3 on: October 03, 2018, 07:31:38 pm »
Even a low end 8 bit AVR or PIC can easily do 32 bit maths in C.   

The question is: how much maths and how fast?  Without hardware assistance, multiplication, and especially division are much more resource and CPU intensive than addition/subtraction.  The cost of maths functions depends on their implementation e.g. number of terms in the series approximation and complexity of each term.

If you specify the number of 8 bit ports to be read,  whether or not there is a strobe or trigger that indicates 'data valid', the maximum update rate, and the mathematical calculation to be performed we would better be able to advise on a suitable platform.
 

Offline jpb

  • Super Contributor
  • ***
  • Posts: 1771
  • Country: gb
Re: Raspberry Pi Or Arduino
« Reply #4 on: October 03, 2018, 07:47:45 pm »
My understanding is that a Rasberry Pi and an Arduino are different beasts. The Rasberry Pi is geared for calculations and running programs but will be less precise in timing of inputs and outputs, that is it is not particularly designed for real-time interrupt handling.

The Arduino is more designed for interacting with hardware but is less powerful for doing processing.
 

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: Raspberry Pi Or Arduino
« Reply #5 on: October 03, 2018, 08:16:10 pm »
OK, an idea of the task

1) Input 4 x 8 bits using an 8-bit port and some chip select lines. All signals at CMOS (74HC) levels

2) Assemble these into a single 32-bit word

3) Work out ((2^32) / input word) + stored offset), integer maths will be fine here

4) Output the result to the display using either an SPI or I2C interface

5) If required by an external command output the displayed number through the USB port to the PC

I'm prepared to switch from BASIC to C as the maths requirement is not too hard and speed is not really an issue as a displayed result that updates ten times a second will be just fine.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline HB9EVI

  • Frequent Contributor
  • **
  • Posts: 722
  • Country: ch
Re: Raspberry Pi Or Arduino
« Reply #6 on: October 03, 2018, 08:31:07 pm »
I don't want to talk too bad about the Pi, but for my general needs, they are too bleeding edge for reliable operation - both software and hardware.

All over the years it turned out to be more reliable to interface any kind of peripherals either directly via USB/UART or USB/I2C to my server or to operate them by a Mcu, which - if needed - can be controlled by PC as well.
For serious needs I'd rather take an Apu or Alix board from pcengines than a Pi

Pi is nice and fun for experimenting though
 

Online TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: Raspberry Pi Or Arduino
« Reply #7 on: October 03, 2018, 08:38:03 pm »
One point to consider is boot time.  An arduino or microcontroller based system will be ready to run in fractions of a second, while a Pi needs a lot of time to boot from the SD card. 

Another factor is that the Pi requires a clean shutdown to avoid filesystem corruption, while a microcontroller based system will reboot without issues.
 

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1560
  • Country: gb
Re: Raspberry Pi Or Arduino
« Reply #8 on: October 03, 2018, 09:29:07 pm »
Raspberry Pi GPIO's are 3.3V only, so you may be better off with an Arduino just for that reason.
 

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Raspberry Pi Or Arduino
« Reply #9 on: October 03, 2018, 09:31:55 pm »
5) If required by an external command output the displayed number through the USB port to the PC

I will assume that means you will send data over a USB serial link, and some code on the PC will read the serial port and display the data.

Quote
I'm prepared to switch from BASIC to C as the maths requirement is not too hard and speed is not really an issue as a displayed result that updates ten times a second will be just fine.

I would definitely suggest Arduino, because it is well within performance and a lot easier to program the external IO. If I had the parts, it would probably take a couple of hours to wire up on a breadboard, write the code and get it working. For someone who has experience with PICAXE, I think it would be quite straightforward, probably the learning curve will be in getting to grips with C/C++.

Bob
"All you said is just a bunch of opinions."
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Raspberry Pi Or Arduino
« Reply #10 on: October 03, 2018, 09:54:50 pm »
So, Arduino or Raspberry Pi, and please explain your answer  :popcorn:
Depends on power requirements.  If Battery Powered... Arduino or ESP32... if powered from a mains supply... Pi.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4033
  • Country: nz
Re: Raspberry Pi Or Arduino
« Reply #11 on: October 03, 2018, 09:55:00 pm »
OK, an idea of the task

1) Input 4 x 8 bits using an 8-bit port and some chip select lines. All signals at CMOS (74HC) levels

2) Assemble these into a single 32-bit word

3) Work out ((2^32) / input word) + stored offset), integer maths will be fine here

4) Output the result to the display using either an SPI or I2C interface

5) If required by an external command output the displayed number through the USB port to the PC

I'm prepared to switch from BASIC to C as the maths requirement is not too hard and speed is not really an issue as a displayed result that updates ten times a second will be just fine.

Ten times a second. No significant internally stored data.

The smallest AVR or PIC will do the job just fine. And would, even if it was 100 times a second. Maybe 1000. Even using the much maligned Arduino IDE and libraries for everything.

The 32 bit division will take a while -- maybe as much as 20 us? But you just declare your variables as "unsigned long" in C and the compiler will sort it out.

A Raspberry Pi is huge overkill for this. But it would work too.
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: Raspberry Pi Or Arduino
« Reply #12 on: October 03, 2018, 10:56:09 pm »
Or maybe use what you already know- picaxe. I don't know anything about picaxe, but if it can't handle what you describe, it must be quite limited.

Maybe you just need to rethink the problem a little- for example, if you are short on pins you can use 4 parallel to serial shift registers (74HC165 for example, <$0.40ea) and grab the whole 32 bits at once, shift them all in and you have a 32bit value that was taken in a single point in time (may not be important or may be- don't know). You still need some pins, but I would guess only about 4.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3356
  • Country: nl
Re: Raspberry Pi Or Arduino
« Reply #13 on: October 04, 2018, 12:45:49 am »
I do not have much love for neither RasPi nor Arduino.
RasPi, is dirty and to far away from the open source software as long as they keep using the Broadcom chips and binary blobs.
But there are a pretty big number of other ARM Linux boards available at comparable prices.

"Arduino" has never been meant to be used by programmers, but by "artists" whatever that means.
"arduino" gobbles up all your hardware so you can not use it anymore in the way you want.
"arduino" makes me particulary sad because it teaches bad programming techniques to hundreds of thousands of new programmers.
It is very easy to get your first blinking led project to work without prior knowledge of uC's, and hats of for that, but after some time you bump into the artifical limits of the arduino stuff.
If only they had the sense to not pre-instantiate objects for all the peripherals and let the choice to the user.
It could have been such an excellent platform for teaching C++.

Back to your project:
You should ask yourself:
Does my project benefit from a full blown linux system?
Do I need stuff like:
- HDMI / VGA output.
- Complete file system.
- PC keyboard / Mouse / GUI
- Multiple MB of RAM for intermediate data.
- GHz scale processor power.
If you need stuff like that, then one of the many Linux single board computers may well suit your needs.

If you just want to do some calculations which are easily handled by a <100MHz microcontroller, combined with some SPI / UsART and other peripherals readily available on a microcontroller then it is very likely that a single chip microcontroller is the better option for you.

Actually, I'm surprized you ask.
You say you have experience with dsPIC, so you should have a reasonable good Idea of what you can do with a microcontroller and what you need for your project.

Ah. Now I realize I fell for it.
You are just trolling and trying to start some flame war.
What a waste of effort from well meaning people.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4033
  • Country: nz
Re: Raspberry Pi Or Arduino
« Reply #14 on: October 04, 2018, 01:00:07 am »
Incidentally, calculating 2^32/input_word directly actually needs 64 bit integers. Or at least bigger than 32 bit :-)

However, (2^32-1)/input_word can be done with standard 32 bit (unsigned) integers.

The only values of input_word for which the answer is different are the powers of two -- the numbers for which exactly one bit is set. In which case the correct answer is 1 larger than you get from (2^32-1)/input_word.

So you can do something like:

Code: [Select]
unsigned long calc(unsigned long input_word){
  unsigned long result = 0xfffffffful/input_word;
  if ((input_word & (input_word - 1)) == 0) ++result;
  return result;
}
[code]

 
The following users thanked this post: Ian.M

Offline kaevee

  • Regular Contributor
  • *
  • Posts: 110
  • Country: in
Re: Raspberry Pi Or Arduino
« Reply #15 on: October 04, 2018, 01:14:15 am »
OK, deep breath because the flame wars here could be spectacular.

I want to build a project that has a small computing requirement including reading a number of eight bit ports and outputting to a text based VFD display after some calculation. The CPU board needs to be 32-bit as I will be handling some large numbers and whatever processor I pick I will need to learn from scratch again as (up to now) I have been using PICAXE. System I/O through a USB port will be required.

So, Arduino or Raspberry Pi, and please explain your answer  :popcorn:

You may consider using a TI Launchpad or ST Discovery board instead of Arduino board. Unlike Arduino, they provide you debugging out of the box.

Checkout TI MSP-EXP430FR5994 launchpad based on MSP430FR5994 available for $17 and TI usually ships for $6. Here are the list of features (copied from TI)
  • EnergyTrace++ Technology available for ultra-low-power debugging
  • 40-pin LaunchPad kit standard leveraging the BoosterPack ecosystem
  • On-board eZ-FET debug probe
  • 2 buttons and 2 LEDs for user interaction
  • On-board micro SD Card
  • Super Capacitor (0.22 F)
TI Claims

The MSP430FR5994 includes the new Low-Energy Accelerator (LEA). This new hardware module delivers fast, efficient, low-power vector math acceleration commonly found in digital signal processing (DSP) applications. This makes it easy for the MSP430 to process incoming analog data in real-time. With benchmarks that outpace 32-bit ARM® Cortex®-M0+ MCUs by more than 40x, this nimble MCU delivers performance with exceedingly low power consumption.



You may also checkout ST discovery boards which pack lot of processing power.
 

Offline rjp

  • Regular Contributor
  • *
  • Posts: 124
  • Country: au
Re: Raspberry Pi Or Arduino
« Reply #16 on: October 04, 2018, 01:15:10 am »
a 555 timer should handle this fine.
 

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: Raspberry Pi Or Arduino
« Reply #17 on: October 04, 2018, 03:13:53 pm »
Thank you for the replies so far. The main reasons why I had to switch from the PICAXE system are twofold, firstly there is still no decent way of doing 32-bit maths on the system without a weird (and slightly unobtainable) maths coprocessor, and secondly the entire PICAXE ecosystem seems to be dying having been beaten to death by Arduino and Raspberry Pi between them. So, when in Conrad on Tuesday night I looked for microcontrollers it seemed to be a straight choice between the two main players.

To Doctorandus_P, I must admit that it takes a certain amount of chutzpa to accuse someone with nearly two thousand posts of being a troll but you managed it  :)  Fortunately after a working life of nearly forty five years I've developed a reasonably thick skin.

The math examples in some of the posts is interesting and I am not sure why I would need 64-bits. 2^32/n where n is a number somewhere between 1 and 2^32 can still be done in 32 bits (I think) but then I'm an electrical engineer who is still learning this stuff.

The decision is made, I will get an Arduino module this weekend and dive headlong into the wonderful world of C/C++ programming. After learning Ladder Logic and BASIC this will be my third language.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Raspberry Pi Or Arduino
« Reply #18 on: October 04, 2018, 09:35:03 pm »
The math examples in some of the posts is interesting and I am not sure why I would need 64-bits. 2^32/n where n is a number somewhere between 1 and 2^32 can still be done in 32 bits (I think) but then I'm an electrical engineer who is still learning this stuff.

An unsigned 32 bit can hold a value from 0 to 2^32-1. Maybe the difference is not significant for your application and you are being approximate. I don't how many digits of precision you intend to display, but you could probably use float instead.
Bob
"All you said is just a bunch of opinions."
 

Offline Dielectric

  • Regular Contributor
  • *
  • Posts: 127
  • Country: 00
Re: Raspberry Pi Or Arduino
« Reply #19 on: October 05, 2018, 01:08:40 pm »
Not everything in the Arduino universe is AVR-based.  The Teensy 3 is fully supported within the ecosystem and is also a pretty nice 32-bit Cortex M4, and the bigger ones have a floating point unit (M4F).  It doesn't sound like you need shield support so the smaller form factor may even be a benefit.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Raspberry Pi Or Arduino
« Reply #20 on: October 05, 2018, 01:24:13 pm »
OK, an idea of the task

1) Input 4 x 8 bits using an 8-bit port and some chip select lines. All signals at CMOS (74HC) levels

2) Assemble these into a single 32-bit word

3) Work out ((2^32) / input word) + stored offset), integer maths will be fine here

4) Output the result to the display using either an SPI or I2C interface

An arduino uno can do all that just fine, me thinks.

5) If required by an external command output the displayed number through the USB port to the PC

The PC will see it as a serial port.

A Raspberry Pi takes ages to boot, compared to an arduino.
« Last Edit: October 05, 2018, 01:26:22 pm by GeorgeOfTheJungle »
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Raspberry Pi Or Arduino
« Reply #21 on: October 05, 2018, 01:34:07 pm »
OK, deep breath because the flame wars here could be spectacular.

I want to build a project that has a small computing requirement including reading a number of eight bit ports and outputting to a text based VFD display after some calculation. The CPU board needs to be 32-bit as I will be handling some large numbers and whatever processor I pick I will need to learn from scratch again as (up to now) I have been using PICAXE. System I/O through a USB port will be required.

So, Arduino or Raspberry Pi, and please explain your answer  :popcorn:

Arduino can handle 32-bit numbers, will be a lot simpler learning curve, will boot very quickly (no need to load an entire graphical OS).

I guess it all depends on what "large numbers" are.  :popcorn:

 

Offline German_EETopic starter

  • Super Contributor
  • ***
  • Posts: 2399
  • Country: de
Re: Raspberry Pi Or Arduino
« Reply #22 on: October 05, 2018, 07:44:54 pm »
In this case 'large' is an integer somewhere between 1 and (2*32) - 1.

Until I started digging I didn't realize that the Arduino processors are mostly eight bit and the ability to handle numbers larger than 255 is done through the compiler! This is damn annoying as it means that Revolution Education (the people who run PICAXE) could have introduced thirty two bit variables years ago just by modifying the IDE and the compiler. OK, it would run slower, but it would still be useable.
Should you find yourself in a chronically leaking boat, energy devoted to changing vessels is likely to be more productive than energy devoted to patching leaks.

Warren Buffett
 

Offline taydin

  • Frequent Contributor
  • **
  • Posts: 520
  • Country: tr
Re: Raspberry Pi Or Arduino
« Reply #23 on: October 05, 2018, 08:02:25 pm »
The biggest reason to go PI is the GNU/Linux operating system. If you want to leverage all of the possibilities that the GNU/Linux can give, and you have some experience with GCC (GNU Compiler Collection), then PI is the way to go.

But if this is a one off job, and you want to write some code and be done with it, then Arduino is the way to go.
Real programmers use machine code!

My hobby projects http://mekatronik.org/forum
 

Offline donotdespisethesnake

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: gb
  • Embedded stuff
Re: Raspberry Pi Or Arduino
« Reply #24 on: October 05, 2018, 09:34:57 pm »
Until I started digging I didn't realize that the Arduino processors are mostly eight bit and the ability to handle numbers larger than 255 is done through the compiler! This is damn annoying as it means that Revolution Education (the people who run PICAXE) could have introduced thirty two bit variables years ago just by modifying the IDE and the compiler. OK, it would run slower, but it would still be useable.

Hmm, slower, but also use more RAM and Flash, unless used sparingly. The top end PICAXE has 16kB Flash and 1280 bytes RAM, compared to Arduino Uno which is 32kB Flash and 2kB RAM, and then there is the Arduino Mega which has 256kB Flash and 8kB RAM.

Writing compilers is not entirely trivial, Arduino leverages the gcc suite which already had AVR support in it, and the Java IDE was also not written by them, so they started with a good base of powerful software, and they have spent their effort tailoring the system for Arduino. I think that the PIXAXE software is proprietary and all written in house, as far as I know.

Unless you are doing some heavy number crunching, native 32 bit is not that big a deal, but there is Arduino Due which is 32 bit Cortex M3 at 84MHz. I think you will be pleasantly surprised by the power and ease of the Arduino ecosystem if you are coming from a PICAXE background.

Bob
"All you said is just a bunch of opinions."
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf