Multiple Problems with Arduino Leonardo

Hi Everyone

I am getting extremely frustrated with the Arduino Leonardo and I really hope there is some fix for my problems.

It seems that the Leonardo somehow seems to think it is two devices. In one mode everything is fine, in the other mode the LED at pin14 starts to blink (or sort of fade in and out) and its useless. This also reflects in my laptops (and those of my students) task manager, where the Leonardo identifies as two different devices, often switching back and forth continuously. In particular I am having following problems:

  1. Uploading code usually does not work. Thanks to a post by Nick Gammon, I figured out that this can (most of the time) be fixed by holding down the reset button while the code is compiling.

  2. If I unplug the Leonardo from USB power and then plug it back in, I usually need to re-upload the code for the sketch to work properly.

  3. The serial communication often randomly stops working. The Leonardo then acts as if its communicating with some other software. (i.e. the Arduino IDE tells me no serial port available, but the Leonardo itself is doing what it should.)

All of these things can be worked around, however it is extremely frustrating, as I am working with kids who have no idea of anything (most kids already need instructions on how to unzip the software). The fact that the boards need to be coaxed and cradled in order to perform seems like such an unfair hurdle to them, especially as I know that other boards don't have these issues, but simply work.

However I am now running into more problems, and I cant even solve them myself:

4) The leonardo stops functioning and resets without any obvious reason I can identify
(EDIT: I assume this was a power problem - some tweaking of the code made it go away. The fact that the serial connection is as flaky as it is just made it difficult to debug and initially lead me down a wrong rout. I just deleted the rather lengthy explanation of the problem as its no longer relevant. My core displeasure with the leonardo stays though :-/ )

a) Is there anything I can do to make these boards behave? Is there anything I am doing wrong? Am I missing something?

b) Assuming I am not the one who is doing it wrong - then these boards are really faulty. I am quite angry as I just bought 20 of them and they are making this a lot more difficult than it need be. Both for me and my students. I wish I would have bought other boards and I wish I could return them or exchange them. Am I the only one who has these complaints? Is there any official word on this?

I just read through http://arduino.cc/en/Guide/ArduinoLeonardo and they do address some of the issues I have. However, they don't really offer any solutions other than the work arounds I have already found and I still don't know why my sketch is currently resetting.

Anyway. I do welcome suggestions on how to handle these boards with the least problems as I am stuck with them for the time being.

Cheers

p.

Hi, I very much like the Leonardo and I'm still trying to figure out how to use it with minimal hassle. It's true that it thinks it's two devices in one -- and that's why I wanted to try it, by the way.

One is a simple communications device, the other is a communications device plus a human interface device (mouse, keyboard). The simple comms device disappears after a few seconds from boot/reset (during this time the PC can only talk to the bootloader). Then the Leonardo resets again, the PC sees a different device, and the HID device appears.

One of the problem is: there is always the possibility that some process running on the PC takes control of the device, maybe just to probe its capabilities, interfering with normal operations (I'm not running Windows so I cannot test, but I think that things like the Fax manager are always looking for modems with fax capabilities, and they'll check the Leonardo whenever it's connected). If I had problems of stability (which, however, I don't -- on Linux and OS/X) I would start investigating the processes/services that may periodically scan COM ports (including antivirus software scanning the drivers).

In the guide page you linked, they suggest putting an infinite loop on while(!Serial), i.e. waiting for Serial to be ready to communicate. They do not mention, however, that this is blocking -- if you put that statement in setup() your sketch will not start until you open the serial monitor. So there are downsides to this "solution" and sometimes it is not advisable.

My only suggestion for a smoother workflow is to find a serial terminal program (putty may be too complicated, but I'm sure there are many alternatives) to be used in place of the Serial monitor. Educationally, this highlights the difference between the develop/deploy cycle and the runtime cycle: if the Leonardo is working you don't need to open the IDE and the SM to interact with it. Functionally, this may contribute to better communications: if kept open the terminal will prevent other processes from grabbing the com port (you'll have to close the connection when uploading a new sketch, but that's part of the deploy cycle).

Thanks for your suggestions. They actually make sense and help me understand the whole thing a lot better. However, they still are not very beginner friendly.

Just finished a workshop on robotics with 25 kids aged 11 to 12. Some of these kids appear to have never used a computer (except for their fancy smartphones) before. They need help finding the "start" button on Windows7.

As expected they ran into a ton of problems with serial debugging working sometimes, uploads working sometimes. By know I have figured out that unplugging the Arduino, exceting all programs which search for serial communication (as spatula suggested) and then restarting Arduino Hardware & Software usually fixes the problem. But it just costs so much time. And the kids don't understand why it sometimes works and sometimes doesnt (heck, I only vaguely get what the problem is.) There is no way I can explain to them in words which makes sense to them what the problem is.

And it ends up being pretty frustrating for them - usually they think that they are doing something wrong.

And I just feel really bad for them having to deal with all this. And could kick myself for deciding to buy 25 Leonardos without using one before. Blind trust in Arduino misplaced :frowning:

P.S.

Does anyone want to buy some Leonardos?

P.P.S

This discussion pretty much sums up my feelings: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=989665

i agree wholeheartedly. The Leonardo is an abomination that was created to solve a problem that never really existed. Sorry if this sounds harsh but it is how I feel, and I am only stuck with one of them, not 25. I used mine for about 15 minutes and just gave up. There was/is absolutely no reason to put up with it's ridiculous behavior.

For your application, there are a lot of great boards around that were specifically designed to be used in a classroom/development environment. Like this: OMS Omega-328 SB AVR MCU Arduino compatible (Free Atmega328!) | eBay

I got one and have not looked back. It is soooo much nicer to deal with for development work than even an Uno or Duemilanove. The only thing is that it's bigger and not really suitable for embedding in a final project. Not that I'd do that anyway, but others seem to from time to time.

I know it does not help you now, and I wish I knew a way to do that, but you have my sympathies. I feel for you.

This really is one nice looking platform! Thanks for the link.

I have come to the conclusion that I am beyond help - guess its my own fault for buying them without prior testing. However I needed them fast and they where the only ones my supplier had 25 pieces available at that moment :-/

Reading that someone agrees with me already makes me feel a bit better though :slight_smile:

I have this vague Idea of asking the Arduino Team for a refund or an exchange, but I am not sure how to go about it though. I mean... it is almost 500€ worth of material which is basically not performing how I expected it to. I cant really claim it was "false advertising" though as they do document at least most of its little quirks. Still I somehow feel cheated out of my money. Eventually I will be buying new boards and these will be left to collect dust or maybe I can sell them over e-bay at a loss and with a bad conscience.

Ha!

My co-worker, who is one of the best people at rapid prototyping I know, just asked me if I had a bunch of arduinos, as he needs them for a project. I gave him some Leonardos.

20 minutes later he came back and placed them on my desk saying "Thanks, but no thanks"

Good story. At least we know we're not alone.

We are having problems with the Arduino Leonardo trying to input 2 analog read PIR sensors. When we hook up the second sensor the readings we get are not what is expected and the values are all over the place. So, our understanding is the Leonardo has one analog to digital converter and cannot process the signals. We set a delay to read the second sensor so it could possibly go through the analog to digital converter but no luck. We need help!

fkeel:
I have come to the conclusion that I am beyond help - guess its my own fault for buying them without prior testing. However I needed them fast and they where the only ones my supplier had 25 pieces available at that moment :-/

Eventually I will be buying new boards and these will be left to collect dust or maybe I can sell them over e-bay at a loss and with a bad conscience.

The ATmega32u4 based boards take some time to get used to. The startup sequence is a bit more complex and has to be understood to get out of the different error states that can occur. When everything fails you have to basically while compiling the sketch hit the reset at the right time, download the sketch and not bring up the serial monitor too late or too early. It is easy to get frustrated and disturb the start sequence. On top of this the USB connection can be lost and the lock file might not be removed. This gives even more error states to consider.

If you still cannot get used to the boards I would recommend first going to the supplier and then to the manufacturer.

In Cosa I try to hide a lot of the issues with the USB Serial. There is no need for the "while (!Serial);". The startup sequence will handle that. Cosa is an alternative support library for the Arduino and replaces the Arduino/Wiring core.

Cheers!