Arduino Forum

Community => Bar Sport => Topic started by: perkunas on Oct 10, 2012, 05:51 pm

Title: I'm not a troll but....
Post by: perkunas on Oct 10, 2012, 05:51 pm
After finishing my project that's been on going for 2 years this is what happened.
1) I had a heck of a time getting the IDE to work under Linux (gave up used windows)
2)Halfway through the program I found it impossible to multithread and multitask, something you want to do after your 1st blinky.
Oh sure you can write a state machine, or some other trick but that's not true multitasking, confusing totally impractical.
Tried the commercial software more of the same and impossible to figure out. The only other solution was occam-pi a great project, but seems like it gets little support and is in beta format. In fact from what I understand is that they are not even allowed to use the Arduino IDE.
So I dumped my arduino and got myself a netduino, I really had no choice, this arduino just wont work. Within a couple hours I had 16 things multithreading and tasking. It was like a dream come true, which makes you think why I wasted all that time on the arduino. Its also nice to have the faster processor, more memory, and to be able to write in C# or even Visual Basic, Oh ya it even cost less go figure.
Nothings perfect, but the product needs to work for you.

Title: Re: I'm not a troll but....
Post by: dxw00d on Oct 10, 2012, 05:58 pm
Quote
Nothings perfect, but the product needs to work for you.


No argument from me. If it works for you, then it's the right choice. The netduino's i/o is weaker though, which is one reason people stick with Arduinos.
Title: Re: I'm not a troll but....
Post by: retrolefty on Oct 10, 2012, 06:08 pm
And there are of course those Arduino users that understand the limits of what one can do with a 16MHz 8 bit processor with 2K or 8K of SRAM space and properly select projects that can be done within those limits. The fact that you have projects and applications needs that exceed what one can reasonable do with an Arduino is certainly not a reason to cast dispersions on the Arduino platform. One always needs to select the proper tools for the job. So grow up with the attitude thingee, if you selected the wrong tool for your projects then that was your error, not the fault of the Arduino.

Lefty 
Title: Re: I'm not a troll but....
Post by: perkunas on Oct 10, 2012, 10:52 pm
"The netduino's i/o is weaker though, which is one reason people stick with Arduinos."
How so, the pin layout is the same, are you saying the arduino is faster, maybe idk but a nanosecond here there shouldn't mater on most projects.
Also if your only concern is i/o then you have the wrong product, you should be using a phidget and not a microcontroller.


Title: Re: I'm not a troll but....
Post by: liuzengqiang on Oct 11, 2012, 06:11 am
Right tool for the right job. You may be a c sharp wiz but everyone else is not. What was your project anyway?
Title: Re: I'm not a troll but....
Post by: cmagagna on Oct 11, 2012, 07:16 am

"The netduino's i/o is weaker though, which is one reason people stick with Arduinos."
How so, the pin layout is the same, are you saying the arduino is faster, maybe idk but a nanosecond here there shouldn't mater on most projects.


I think he means "weaker" as in less power.  Arduino pins can drive up to 20 MA at 5V; the Netduino's pins are 3.3V and some of the analog pins can only do 2mA.
Title: Re: I'm not a troll but....
Post by: dxw00d on Oct 11, 2012, 08:53 am


"The netduino's i/o is weaker though, which is one reason people stick with Arduinos."
How so, the pin layout is the same, are you saying the arduino is faster, maybe idk but a nanosecond here there shouldn't mater on most projects.


I think he means "weaker" as in less power.  Arduino pins can drive up to 20 MA at 5V; the Netduino's pins are 3.3V and some of the analog pins can only do 2mA.


That's exactly what I meant.

Quote
Also if your only concern is i/o then you have the wrong product, you should be using a phidget and not a microcontroller.


Nonsense. If I want something permanently stuck to a PC, then a dumb device might be appropriate, but an Arduino can run standalone, and can better interface with other devices than the netduino.

I'm beginning to think your thread title might not be entirely true.
Title: Re: I'm not a troll but....
Post by: perkunas on Oct 11, 2012, 02:48 pm
"I think he means "weaker" as in less power.  Arduino pins can drive up to 20 MA at 5V; the Netduino's pins are 3.3V and some of the analog pins can only do 2mA"

That's only some what true, my pins run at 5v
(they are 5 volt compliant, but normally work at 3.3vdc)
I'm not sure, but I don't think you can do that with a analog pins.

"What was your project anyway"
It was a Hydroponic controller it had to control water, temp, PH, nutrients, Lights ect.
All at the same time ie. multitask (something arduino cant do)
"You may be a c sharp wiz but everyone else is not."
C# wizard, no hardly, but most programers use and like C#, so its easy to get the help you need,
and believe me I needed lots of it. Actually I like visual basic, its what most of us stared with as kids.
That's going to be fun to play with.


Title: Re: I'm not a troll but....
Post by: dxw00d on Oct 11, 2012, 03:28 pm
Quote
All at the same time ie. multitask (something arduino cant do)


You mean "something I wasn't able to make the Arduino do".

Try looking at what others are doing with Arduinos.

This aquarium controller is doing just as much as your project - http://www.marineaquariumsa.com/showthread.php?t=26372

GardenBot is an excellent modular system - http://gardenbot.org/about/

HydroBot does all yours does, and serves a pretty smart looking web interface to monitor and control it - http://www.cs.helsinki.fi/u/ljlukkar/hydrobot/
Title: Re: I'm not a troll but....
Post by: John_Smith on Oct 11, 2012, 04:30 pm
Quote
It was a Hydroponic controller it had to control water, temp, PH, nutrients, Lights ect.
All at the same time ie. multitask (something arduino cant do)


This all sounds rather slower than reflexes required for landing a Mars probe :-)

Surely the plants can wait a couple of loops through the program to get their water or nutrients ?
Title: Re: I'm not a troll but....
Post by: AlxDroidDev on Oct 11, 2012, 04:43 pm

(...) One always needs to select the proper tools for the job. So grow up with the attitude thingee, if you selected the wrong tool for your projects then that was your error, not the fault of the Arduino.


Touché!

Well said, mate, and that is exactly the first thing that came to my mind when I read the OP.
Title: Re: I'm not a troll but....
Post by: Grumpy_Mike on Oct 11, 2012, 04:51 pm
Quote
but that's not true multitasking,

No you only get true multitasking with multiple cores which you don't have on a netduino.

Quote
some of the analog pins can only do 2mA"

That's only some what true, my pins run at 5v
(they are 5 volt compliant, but normally work at 3.3vdc)

You mean 5 volt tolerant not complaint, that only applies to when the pins are in input mode not output mode.
Title: Re: I'm not a troll but....
Post by: liuzengqiang on Oct 11, 2012, 05:50 pm

"What was your project anyway"
It was a Hydroponic controller it had to control water, temp, PH, nutrients, Lights ect.
All at the same time ie. multitask (something arduino cant do)
"You may be a c sharp wiz but everyone else is not."
C# wizard, no hardly, but most programers use and like C#, so its easy to get the help you need,
and believe me I needed lots of it. Actually I like visual basic, its what most of us stared with as kids.
That's going to be fun to play with.


You can certainly do this project with arduino but it's more of a personal preference to use or not to use multitasking libraries (I don't know if multitasking is supported by netduino hardware, such as task save-and-switch, privileges, memory protection etc.). You can easily use arduino to monitor all sensors and control all pumps if you want but you prefer the conceptual simplicity of multitasking. Fair enough.

Just a side comments of programmers being able to help, last time I helped my programmer friend fix his meat slicer, all the problem was that its fuse box was cheap and the cap fell out of the socket with the fuse and he didn't know or mentioned those were important parts of the machine. We opened the thing and tested every part and I traced the wire to a box and said, "Was there anything you didn't show me?" He then produced a couple of loose parts, being the cap and the fuse. Software and hardware people have been trained very differently. Despite that, I see good mix of both sides with arduino. You may be capable man/woman with hardware but you should hope your software people are too. Not long from now you will demand even more memory and faster processor speed since you do multitasking and visual basic, exactly what microsoft has been demanding.
Title: Re: I'm not a troll but....
Post by: JoeN on Oct 11, 2012, 11:57 pm
I'm wondering how the Netduino "even cost less" than an Arduino.  I have never see this.  It's $35 at both Amazon and Sparkfun.  Arduino R2 is still $22 at Amazon.

My day job is writing .NET code.  IMHO, one of the best things about the Arduino is that it doesn't run .NET.  I don't need that sort of heavyweight wrapper on this sort of device.
Title: Re: I'm not a troll but....
Post by: Osgeld on Oct 12, 2012, 04:44 am
agreed, .NET is nice on complex problems, it kicks you in the crotch and steals you wallet when you just want it to go from A to B doing something simple, like controlling a plant system.

I have to say, I dont get the problem here, theres no multitasking, your just writing more convoluted code thats going to be executed in order at the end of the day, just like a loop. Its nothing more than timesharing between program items.

if you like the netthingie great, but there is more than one tool in the shed, and they all have their benefits. I personally have an arsenal of controllers, and I am not going to use my 800Mhz Vortex86 to blink a LED, nor am I going to use my arduino as a image processor. 
Title: Re: I'm not a troll but....
Post by: Ran Talbott on Oct 13, 2012, 03:08 pm

No you only get true multitasking with multiple cores

No, that's "multiprocessing".  This Wikipedia article (http://en.wikipedia.org/wiki/Computer_multitasking) gives a good explanation of the differences among the various "multi-"s.

You might say that multitasking is "virtual multiprocessing":  like "virtual memory" or "virtual machines", it provides the illusion of having more physical resources.
 


Title: Re: I'm not a troll but....
Post by: mbanzi on Oct 18, 2012, 11:41 am
@perkunas

a couple of comments.
1. the linux IDE surely could use some love but it's also a nightmare to get it to work with all these different permutations of distributions and packages etc 
2. It really depends on what is your style of programming. If you've learned on a modern computer and are used to multithreading, multitasking and all of that, clearly Arduino seems very limited but if you apply different coding patterns  you can get a LOT of mileage out of it. I teach my students about state machines all the time, I just don't tell them they are called like that and they can implement them very easily.

PS: I learned on a ZX81 which had 1kb of ram and Arduino is like a Ferrari compared to that :)

m
Title: Re: I'm not a troll but....
Post by: GoForSmoke on Oct 18, 2012, 10:34 pm

2)Halfway through the program I found it impossible to multithread and multitask, something you want to do after your 1st blinky.
Oh sure you can write a state machine, or some other trick but that's not true multitasking, confusing totally impractical.


Yet another modern PC programmer who does not understand state machines. No surprise there.

What Mike said, you need multiple cores to do "true multitasking". Which is possible with Arduino when you add MCU's... I'd go for SPI or I2C bus and some extra 1-wire bus comms as needed but the real question is why for a task like yours? Organized and written properly it should be well within the capabilities of an Arduino.
Title: Re: I'm not a troll but....
Post by: mbanzi on Oct 19, 2012, 12:02 am
the arducopter/ardupilot code should provide a good example of how far you can stretch the hardware of an Arduino :)

m
Title: Re: I'm not a troll but....
Post by: MichaelMeissner on Oct 19, 2012, 03:13 am


2)Halfway through the program I found it impossible to multithread and multitask, something you want to do after your 1st blinky.
Oh sure you can write a state machine, or some other trick but that's not true multitasking, confusing totally impractical.


Yet another modern PC programmer who does not understand state machines. No surprise there.

What Mike said, you need multiple cores to do "true multitasking". Which is possible with Arduino when you add MCU's... I'd go for SPI or I2C bus and some extra 1-wire bus comms as needed but the real question is why for a task like yours? Organized and written properly it should be well within the capabilities of an Arduino.

No, you don't need multiple cores to do "true multitasking".  You just need enough memory to allow each thread to run in its own stack frame, and something to do the switching.  There are various thread models that use cooperative threads.

That assumes you are in control of all of the software, and don't use pre-written libraries that use delays.  For example as say the Morse code library and the IR library both do, and which I want to marry together (I have a camera shutter release, that wants to fire off a message in Morse code, but I want to be able to stop the beeping if I get a button press, either a direct button or a button with an IR transmitter).  Yes, I eventually will take the source to both, and rewrite them to use state machines, but it would have been a lot simpler if I didn't have to write everything from scratch, and I can just use the libraries as is.  Both state machines and threads are tools in the toolbox.  Sometimes one is better than the other.
Title: Re: I'm not a troll but....
Post by: liuzengqiang on Oct 19, 2012, 06:55 am
As far as I know about multitasking, not all threads have to be running simultaneously. Think about time-share property (or time-division multiplexing for cell phone people) as a parallel to multitasking on a single processor. IIRC, Intel's first true multitasking processor was the 80386, with hardware dedicated to multitasking, privileges, and virtual memory management, all of which are necessary to make an effective multitasking operating system. I don't know what MCU has that capability nowadays but multitasking is not just hardware but also sophisticated software that organizes tasks and relies on hardware to make each task feel like it is the only task running (virtual memory management for chaining up fragmented memory, memory/hard drive swap, and machine state save and recall etc.) and prevent unauthorized access to memory and other resources by tasks that don't have the privileges. Trying to do simple things all at the same time with multitasking is trying to kill mosquitoes with a canon. The OP may have programmed a general purpose computer for too long and he overlooked the fact that modern computers started not much more capable than arduino (8-bit, little memory) decades ago and back then people controlled multiple things just fine without multitasking software or hardware.

FYI, 80386 had a maximal memory of 4GB and virtual memory space of 64TB. I wonder if any lucky 386 has ever got close to that amount of memory.
Title: Re: I'm not a troll but....
Post by: radman on Oct 29, 2012, 05:17 pm
Quote
No, you don't need multiple cores to do "true multitasking".  You just need enough memory to allow each thread to run in its own stack frame, and something to do the switching.


I disagree. By "true multitasking" people mean threads are really running in parallel - or at least that is what I mean  :)

If you have a single core switching between threads then the illusion is given that things are happening in parallel but the reality is that threads are being processed sequentially even if you are allocating a higher priority and more processor time to some threads. The Arduino can multitask (in what I think is the normal sense of the word) , but it is not "true multitasking".
Title: Re: I'm not a troll but....
Post by: kf2qd on Oct 29, 2012, 06:42 pm
True multi-tasking is 1 processor running various tasks in their own time slot. We have gotten used to Multi-processing with cheaper and cheaper silicon and the resulting ability to pack more in less space. But much of it still boils down to one processor doing several things in sequence, and doing it so fast that it looks like many things are happening in real time.

This has been going on for many years. My first multitaking system was an Allen-Bradley PLC (programmable logic controller) which was able to control various parts of a machine, asynchronously. It ran a tight control loop that executed 535 time a second. Close enough to be called real time. Read an encoder through 12 digital inputs, Had about 48 switch inputs for the various parts of the machine, approx 24 outputs for various motors and solenoids. Had 4 separate subsystems all running their own control sequence at the same time.

It is interesting that with Arduino and such we are just going back to the early days of industrial PLC control. 1 processor managing some I/O and making things do their stuff based on some logic and some inputs.
Title: Re: I'm not a troll but....
Post by: liuzengqiang on Oct 29, 2012, 07:15 pm

It is interesting that with Arduino and such we are just going back to the early days of industrial PLC control. 1 processor managing some I/O and making things do their stuff based on some logic and some inputs.


True until you look at who were using PLCs and who are using arduinos and the level of difficulty using PLC vs. arduino  :P

I thought multitasking was a fancy word for time-division multiplexing with programs. It's always about one unit trying to serve the needs of many. Some people may have confused multitasking with parallel computing, where multiple tasks could be carried out by multiple units at the same time.
Title: Re: I'm not a troll but....
Post by: Peakdesign on Nov 01, 2012, 10:25 am
Gentlemen, gentlemen. If concurrency without interrupts or convoluted schedulers is desired, humbly suggest you look at the Propeller chip/boards (at parallax.com). It's 32 bit with 8 cores that run truly in parallel at 80 Mhz. You no longer have to program it in SPIN or assembly, as there's a new Win/Mac/linux C/C++ IDE (coded in C w/ Qt not slow Java). Break up problems into parallel tasks between the 8 cores. All Prop pins are general purpose. On a Prop if you need a UART, you load up UART code into a core, let 'er rip, read and write data via shared memeory. Need VGA out? Dedicate a core, add a few resistors. The chip is $7. There are also Arduino shield compatible Boards, like the ASC+ (with a lot of goodies) at $49. Nice.
Title: Re: I'm not a troll but....
Post by: GoForSmoke on Nov 01, 2012, 04:26 pm
It looks like applications are loaded into RAM only.. I see no place a program is stored on-chip power-off, ie no flash but hey with external EEPROM it can be used without a PC to load from?

With 8 cores and all the doo-dahs I would like a lot more RAM given that's code and data space.

It definitely has uses Arduino can't easily fill, has a niche, just not the same as AVR nor as cheaply in general.


Title: Re: I'm not a troll but....
Post by: nickgammon on Nov 01, 2012, 11:38 pm
Even multiple cores aren't the golden bullet some people seem to think they are. Multitasking, multiprocessing, multiple cores, multiple boards, whatever.

If they are on the same project they have to work together. There will be a shared resource of some sort or it isn't the same project. Typically multiprocessor systems share the same RAM and the same hard disk. So now you have to compete for that resource. You need critical sections, semaphores, locks, unlocks, etc.

This introduces complexity. It also introduces the possibility of race conditions, where A waits on B and B waits on A, and nothing happens.

The fact is that the Arduino can do quite complex stuff. For example, I've done VGA video output which requires precise timing. Others have done line-following robots, beer brewing machines, helicopters, etc.

I've done an Adventure game where the processor accepts input, and displays information on the screen.

If you think you have to replace your Arduino because you need to do something more complicated than blink an LED, you haven't understood how to make it work, that's all.

There are some limitations, there will be with anything. The basic speed of the processor means you won't be doing 3D graphics in a  big hurry at high resolutions. But what do you expect for $5?