Blog Image

Arduino blog

Arduino thinkering

This blog is about things I come by related to Arduino which I feel are inspiring/important/funny enough to write about.

Support for the arduino IDE boards manager (testers wanted)

Arduino sketch experiances Posted on Sat, June 13, 2015 12:09:03

EDIT as Arduino IDE 1.6.5 is out use this one instead of the nightly

How we got here
As you may know the Arduino IDE introduced the boards manager in arduino IDE 1.6.2 which also introduced an incompatibility with the Arduino eclipse plugin.
Moreover the Arduino ide core team had to provide extra functionality to allow the Arduino eclipse plugin to continue working.
They did so in the current hourly so this will be part of the next arduino ide release (1.6.5). smiley This is cool as it shows the importance of the Arduino eclipse plugin in the Arduino community.
This also means that the current hourly build of the arduino IDE contains “untested” code and the arduino eclipse plugin also contains untested code in relation to the boards manager.

The current situation
I had made quite some changes to the arduino eclipse plugin so it is very likely that issues will appear. I’m currently using the hourly arduino IDE for my work under linux and I’m looking for tester/users to use the arduino IDE hourly together with the arduino eclipse plugin nightly.
!!!!Yes the Arduino IDE hourly. I do not support the Arduino hourly IDE so this is an exception case for testing only!!!!

I don’t expect windows and mac users will be able to get it running smiley so I would like some arduino eclipse plugin experienced users, who know how it should work and if possible can provide a pull request.

What needs to be done?
Due to the nature of the change testing is needed for boards installed via the boards manager (like the due) and boards installed with the Arduino IDE.
Both compilation and upload should be tested on all OS’es.
If you pla to use an existing workspace: do not forget to do the update procedure. Both the arduino IDE and project properties are needed.

reporting of failure is important but reporting of success is even more important.
In case of success please report as follows:
[OS] [os version] [BOARDS] compile and upload OK
The arduino IDE version and arduino eclipse plugin version are not relevant as it is hourly and nightly.
please report at this github issue
If it fails report as detailed as possible (most detailed = pull request) on the same github issue.

thanks jantje.

Controlling Arduino over the web: Blinking a led the cool way. Part 3:Connecting dots

Arduino sketch experiances Posted on Tue, March 24, 2015 13:55:32


If you have not yet read the blog post Controlling Arduino over the web: Blinking a led the cool way. Part 1&2; please read them first.

What you will learn in this post:

In the previous post we add my blinkled library to make a led blink based on serial input.
The point of this post is to change the blinking rate using the serial in a generic way. In other words we want to get rid of the string parsing in the loop() method of the previous example.

I consider this a steep slope learning curve to understand what is going on. To use it; it is a lot easier.

Here is a link to the sample program this article is about.

Lets get started:
Even after two introductory blogs I still find it hard to find the best entry to explain how I do it. So lets start with what you probably think is the most interesting: “What do I need to do to get it to work.”
From a conceptual point of view: What are the steps needed to automate changes to variables via the serial port?

1) A list of the variables you allow access to including the access type.(further on called list)
2) Code to register variables to the list. (further on called serialRegister)
3) A component to control the serial port that uses the list to communicate with the serial port and changes values in Arduino memory. (further on called SerialCommunicator)

The list: conceptually
The list has to contain all the information the SerialCommunicator needs to get his job done.
It needs a pointer to the variable so it can change/read it.
It needs a name so it can be referenced to via the serial communicator.
It needs access control flags so we can have read only objects and read/write objects.
It needs the type of the object so we can convert the text to the correct memory content to write to the pointer.

The DUMP serial command actually dumps the list and the memory values the list points to. Lets look at the partial dump of Marvin my mowrobot for a nice example.

Marvin has a temperature sensitive resistor in a voltage bridge connected to a ADC pin of the Arduino. Arduino calculates the Celsius as follows

name RobotSensors.mow_temp.Left.Celsius
modflag 0
Type int16_t
Value 20

name RobotSensors.mow_temp.Left.ActualReadValue
modflag 0
Type uint16_t
Value 0

name RobotSensors.mow_temp.Left.MultiplyerValue
modflag 3
Type int16_t
Value 6747

name RobotSensors.mow_temp.Left.Offset
modflag 3
Type int16_t
Value 20

Lets go into the dumped fields:
The name is a concatenation of names. I map my class instantiations on the name (it is not necessary to do so). In other words I have a class instantiation RobotSensors which holds a member called mow_temp which holds a member Left which holds the members Celsius, ActualreadValue and MultiplyerValue.

modflag is a collection of binary orred values. The first bit means write the second bit means save (more on save in a later post)
The ActualReadValue is the value arduino returns from the analogRead method. Therefore I do not allow to change the value and modflag is 0.

type: I store the value in a unsigned int so type is uint16_t

value: is 0 as the last analogread before the dump returned O.

Because MultiplyerValue and Offset have the write attribute you can change the value of those while Arduino is running to tune the value of Celcius on the fly -over the web-. Isn’t that cool?

serialRegister: conceptually
Registering is adding a value to the list. You should register all your fields in the setup() routine. For each field you have to register the name, the mod flag, the type and a pointer to the variable.

SerialCommunicator: conceptually
The serial communicator needs to take control over the serial port. This means you can no longer use the serial port as an input device as the Serial communicator is already reading the serial port.
You can however write to it because the SerialCommunicator only writes in his loop() method and will not exit the loop() when the write is unfinished.
Further on the serial communicator must be capable to convert memory variables to a textual representation and the other way around.
The serial communicator must be able to search the list to find the field to modify.
The serial communicator must be capable to report error conditions and feedback actions.
The serial monitor must guard that the read/write rules are respected.

This is a whole lot. But the good news is… The serialCommunicator is a library you can download.

Now we know what the big parts are lets see how to implement them.

list: implementation
I implemented the list as an array. (apart from array I did lots of thinking, considerations and implementations which are out of scope of this article) This means you have to declare an array and assign a size to it. The size of the array is a bit of a pain-point as you have to make it big enough to get all fields into it but you only know how many fields you have when you have compiled and run the code.
This is why the list is actually visible 2 times in the sample program. Once to declare the variable and once to check the size
#define MAXFIELDS 70
FieldData AllFields[MAXFIELDS];
//As MAXFIELDS needs to be big enough it is not a bad idea to know how big it is now
SerialOutput.print(F(“Current memory fields “));
SerialOutput.println(lastFieldIndex); //yes I do use global variables
SerialOutput.println(F(” from “));
SerialOutput.println(MAXFIELDS); //13 of 70 that is way more than enough

As long as you have enough fields in the list you can forget about it.

serialRegister implementation
note: Until now I only talked about field names. However in the code I make a distinction between the class and the field. Field is everything after the last dot (commonly called leave) and class is everything before the last dot. -see the F macro why I did so-

The methods to register a field in the list are called set and setnext. The difference between the 2 is that setnext assumes the class parameter is the same as the previous call to set.
Lets look at the serialregister of led13
void BlinkLedSerial::serialRegister(const __FlashStringHelper* Name)
FieldData::set(Name, F(“OnInterval”),MOD_WRITE|MOD_SAVE,&myOnInterval);
FieldData::set(Name, F(“OffInterval”),MOD_WRITE|MOD_SAVE,&myOffInterval);
FieldData::set(Name, F(“LedState”),0,&myLedState);
FieldData::set(Name, F(“PreviousMillis”),0,&myPreviousMillis);
FieldData::set(Name, F(“LedPin”),0,&myLedPin);


You see I register 5 fields for the led.
I’m using C++ overloading to get the correct type from the pointer. This makes the code far more reliable.

As I use globally instantiated classes and I wrap all the set(Next) calls of a class in the serialRegister method; I mostly only need to call serialRegister for each globally defined class instantiation in setup() to create the whole list.
Just like in the sample program

SerialCommunicator: implementation
I implemented the SerialCommunicator but that does not mean there is nothing to do for you.
One thing I like to know about my sketches running on a arduino is: What sketch is running? Therefore the dump command starts as follows:
Dumping all fields
SketchName MaaiRobot
CompileDate Aug 16 2013

The code can find out the compile date but the SketchName is something you need to provide. Here is how:
const char mySketchName[] PROGMEM=”Serial Communicator step3″;
The second thing to know is that the SerialCommunicator has a serial register that is probably very interesting to register. I (nearly) always register him first.

This is what the loop looks like in this example
// The loop function is called in an endless loop
void loop()
// yes!!!! yes!!! That is all we need in the loop to change the blinking of the led

Really, nothing more is needed. Isn’t this easy to maintain?
Compile the sample, upload and play with it using the serial monitor.
Have fun

What is that with the F macro and PROGMEM..?
(or about strings and memory usage)

As you are probably aware the Arduino has very little memory. The architecture of the AVR also makes that “memory” is not one big thing but it exists out of “program memory” and “real memory”.
The “real memory” is what you are likely to run out first. Using char arrays increases that process. Using compiler directives you can direct the compiler to only use “program memory” this means you need special routines to read the char arrays. You can not write to program memory char arrays.

Arduino implemented the F macro (as far as I know: no pun intended) and __FlashStringHelper to help arduino programmers out. The PROGMEM is a gcc fix.
I’m using this technique to save memory but -due to the no write rule- it has some drawbacks: like the artificial set and setnext and classname and fieldname. The reason is that you can not add 2 PROGMEM/F char arrays and put them in a PROGMEM/F char array.

Controlling Arduino over the web: Blinking a led the cool way. Part 2:blinkled

Arduino sketch experiances Posted on Sat, January 10, 2015 19:19:04


If you have not yet read this blog post Controlling Arduino over the web: Blinking a led the cool way. Part 1:SerialStringReader please read it first.

What you will learn in this post:

In the previous post I discussed the SerialStringReader to read line by line from the serial port.
In this post we add my blinkled library to make a led blink based on serial input.
The point of this post is to get a better understanding of the way I Use classes with setup() and loop().

I consider this a low slope learning curve. The next one will be steep.

Lets get started:

Yes blinking a led is cool. But controlling the on/off rate is cooler. You can do this with 2 potentiometers (one to control the off time one to control the on time) …..but we want to get to web control. Controlling a potentiometer over the web is not exactly easy. We need another way in.

Controlling over the serial port is more ready for the web. Therefore in this example we will use the SerialStringReader to control blinkled directly.

We will use “fixed line commands” to control the blinking of a led.

Note that the code is purely for learning purposes and in no way my advised way.

So here is the code

#include “SerialStringReader.h”

#include “BlinkLed.h”

//for the stream you want to read info from you need to declare a SerialStringReader

//you can only have one

SerialStringReader myCommunicator;

//Define that the USB serial (pin 0 and 1 on the uno) is to be used by the mySerialReader

//If you want to use the yun with the bridge use Serial1

#define THESERIAL Serial

Stream &SerialInput = THESERIAL;

Stream &SerialOutput = THESERIAL;

BlinkLed led13(13,500,2000);

//The setup function is called once at startup of the sketch

void setup()








// The loop function is called in an endless loop

void loop()




if (myCommunicator.messageReceived())


SerialOutput.println(“You have send a message to Arduino.”);

SerialOutput.println(“And the message is:”);

char * message=myCommunicator.getMessage();


if (strcasecmp(message,”LED SLOW”)==0)




SerialOutput.println(“changed to slow”);


if (strcasecmp(message,”LED FAST”)==0)




SerialOutput.println(“changed to fast”);


if (strcasecmp(message,”LED ASYNC”)==0)




SerialOutput.println(“changed to async”);



Before you can build it you need to download the latest version of the lib at

What as changed from the previous demo?

I included blinkled.h and I declared

BlinkLed led13(13,500,2000);

The 3 parameters are the led pin the on interval and the off interval. In other words the led on a arduino connected to pin 13 will be on for 500 mS and then off for 2000mS if you call led13.setup(); in setup and led13.loop(); in loop()

Adding led13.setup(); to setup about covers the changes in setup()

Now lets have a look at loop.

Loop() starts with the expected


Next to that I added a switch case. Unfortunately C/C++ does not support switch cases with strings so I had to implement the switch case with if statements.

The code tests for any of these strings “LED SLOW”, “LED FAST” and “LED ASYNC”.

If one of these lines of comments arrive I change the blinking rate of the led by stetting the on and off interval.

What is in blinkled.

Lets first take a look at the constructor.

BlinkLed::BlinkLed(uint8_t ledPin,uint32_t onInterval ,uint32_t offInterval )


myLedPin = ledPin; // the number of the LED pin

myLedState = LOW; // ledState used to set the LED

myPreviousMillis = millis(); // will store last time LED was updated

myOnInterval = onInterval;



As you can see nothing really exiting.

Now lets look at the set on and off interval

void setOnInterval(uint32_t onInterval){myOnInterval=onInterval;};

void setOffInterval(uint32_t offInterval){myOffInterval=offInterval;};

As you can see I only set the values I do not act upon the change.

This is a very important rule for me. Only the loop() can do calculations and changes.

This approach has a lot of benefits such as:

1. If a loop takes long it can only be because of some code in the class itself.

2. The sequence of changing values is completely irrelevant. Whether you change on first and then off is of no importance as only loop will do actual changes and at that point in time both have been changed.

3. The only object that can have changed state during your loop call is the object itself. As such the loop call can consider itself as “in a stable environment”. This seriously reduces the complexity of the code. Compare it to a board game where typically each player does its move one after the other. Not having this rule makes it comparable to a multiplayer on-line game.

4. Because of these rules the re-usability of the classes has increased.

Draw backs of this approach:

Even though the loop has to accommodate for all actions it still has to be fast. Assume your loop takes 10ms to finish and you have 10 objects that means 100ms for each and every cycle in the main loop to finish. I think that is way to long. In other words: DO NOT USE DELAY() -I guess you have heard this before smiley

now loop()



here is where you’d put code that needs to be running all the time.

check to see if it’s time to blink the LED; that is, if the

difference between the current time and last time you blinked

the LED is bigger than the interval at which you want to

blink the LED.

myInterval =myOnInterval;

== LOW)


myInterval =myOffInterval;


currentMillis = millis();

– myPreviousMillis
> myInterval) {

save the last time you blinked the LED

= currentMillis;

if the LED is off turn it on and vice-versa:

== LOW)






= LOW;


set the LED with the ledState of the variable:




is basically blink without delay.

up next?

that the setup(), loop(), blinkled and serialstringreader are fully
understood it is time to explain a generic way to change attributes
and variables over the serial port.

post a comment if you want that post to be written.

Controlling Arduino over the web: Blinking a led the cool way. Part 1:SerialStringReader

Arduino sketch experiances Posted on Wed, November 12, 2014 23:59:22

The loyal reader of this blog knows I have written a blog entry with a similar title before. However as I keep on using this set of libraries I also keep on improving the libraries. Therefore the old article is getting outdated on the level of practical implementation. I also recently updated all the examples using my new arduino eclipse example link feature so I guess it is time for a rewrite/reread.

Why read this article
What would you think about controlling an Arduino over the network in a easy and generic way?
In a way you only need to change the code and all processes after that are generically enough to change without having to change code?
In a way you can intervene in the intermediate steps?
In a way you automagically get a web interface that allows you to read Arduino variables, set them and save them in eeprom, in a way you fully control/understand?
Does that sound appealing?
Well than you should sit and read this and the next planned blog posts.
These posts will lead you to an example that reads out the position of 3 potmeters connected to A0,A1 and A3. Below is a browser dump of the HTML control.
It’s a long road, and we’ll start slow, but if you need this functionality you’d better hold on tight. On the road you’ll also learn how to save setting in eeprom/yun sd card simply by setting a flag in your code.

Lets get started:
As you probably know the easiest way to communicate with an arduino is the serial port. However the serial port is a byte by byte protocol and as such needs another layer to communicate at a higher level.
People tend to work on a line by line basis. An experienced programmer can easily put a layer on the serial port to do line by line reading. As such it seems kind of crazy to make a line by line reading library. However for building on top of a line by line reader a library is needed. As it is a functionality which is requested by Arduino enthusiasts it deserves it’s own library -in Arduino land-.
So lets start with the first example: a simple line by line reader to get used to the jantje’s way.

#include “SerialStringReader.h”
//for the stream you want to read info from you need to declare a SerialStringReader
//you can only have one
SerialStringReader myCommunicator;

//Define that the USB serial (pin 0 and 1 on the uno) is to be used by the mySerialReader
//If you want to use the yun with the bridge use Serial1
#define THESERIAL Serial
Stream &SerialInput = THESERIAL;
Stream &SerialOutput = THESERIAL;

void setup()

void loop()
//always add the following line to your loop
//mySerialReader.messageReceived() will only return true when a line of data has arrived
if (myCommunicator.messageReceived())
SerialOutput.println(“You have send a message to Arduino.”);
SerialOutput.println(“And the message is:”);
// with mySerialReader.getMessage() we get the actual message
// for the demo we simply play it back.

How to use the sketch
Download the library SerialStringReader from github
Open the example serialCommunicatorStep1
Verify and Upload the sketch. Open the serial monitor (115200 baud) and send messages to Arduino.
Only when an end of line is send Arduino will send the info back.
That is all it does and it does it good 😀

Looking at the sketch code
The first thing I ask you to do when looking at the code is to forget the THESERIAL and SerialOutput for now. See them as simply Serial.

Working with Arduino and classes I got used to adding a setup() and loop() to all my classes. This makes that I can simply extend my existing sketches with functionality by creating a new class instance and simply call the setup and loop in setup and loop. -It probably makes more sense to read the code than reading the previous text 😉 –
This way of working will come back in all the examples here.
First I create an object called myCommunicator of type SerialStringReader.
I call the myCommunicator.setup in setup and myCommunicator.loop in loop. If later on I change the type of myCommunicator to something else there is very little to change.

myCommunicator.messageReceived() tells when a message is received and myCommunicator.getMessage() returns you the message. This is line by line.
The end of line is identified by a CR or LF or both.

Looking at the library code
If you look at the code in the library you will find that setup is blank. Here setup() only exists for compatibility reasons.
And here is the code of loop
void SerialStringReader::loop()
while ((!myHasMessage) && (SerialInput.available() > 0))
char aChar =;
if ((aChar == ‘\n’) || (aChar == ‘\r’))
myHasMessage = myMessageIndex; //this way if \n and \r are send we do not get 2 messages
myMessageIndex = 0;
} else
myMessage[myMessageIndex] = aChar;
myMessage[++myMessageIndex] = 0; // Keep the string NULL terminated
if (myMessageIndex >= MAX_MESSAGE_LENGTH)
SerialOutput.print(F(“Message to long. Max: “));

I use an array to avoid the payload of the string. The size of that array is
#define MAX_MESSAGE_LENGTH (uint8_t)80
80 may seem a bit tight but do not forget serial is a slow protocol. The longer your message the more time. Also the longer the message the more you lose program and data space. To save space I also use uint8_t so if you want messages longer that 255 you’ll need to adopt the code.

Some framework explanation
Now what is this THESERIAL and serialOutput defines/variables about?
These defines and variables I use to easely swap between serial ports.
If you use the yun and want to communicate with the linux part of the yun you need Serial1. However if you connect a UNO to a PC running linux you want Serial. I have connected a MEGA to a yun and I use Serial2.
To be able to swap easily I use THESERIAl and serialInput serialOutput serialError. Like in Linux.
You can swap serial port by simply changing the #define THESERIAL to the wanted port/Stream.

Usage advice
This sample code is Arduino IDE programming level compatible. I do not advice to use the arduino eclipse plugin if you want to stay on this level.

What is next
In the next example we continue this slow pace and blink a LED. How Arduino that is 🙂

help my robot motors are burning!!!

Arduino sketch experiances Posted on Wed, May 14, 2014 22:02:46

As the loyal reader of my posts knows by now… I am building a lawn mower robot. All of the implemented functionality is working fine; except for …. the 4WD engines.
For one reason or another these engines keep on burning. I have used quite a set of different types of engines by now, and all of them get toasted one day. And that day is ….. way to soon. From the last set I used 16 of the 20 motors. It is this set of motors in particular this post is about.

As the burning motors drives the development cost to unknown heights and it drives the development spirit to unknown lows, I have added heat sensors to the engines. the idea is to stop the robot before the motors get to hot.
The first question is what is to hot? Wikipedia comes to help
As for the motors no special rating is given I assume it is less than 90°C. Some other web page stated 70°C for standard insulation wire.
As I’m not measuring the heat of the insulation but the outside of the motor I took 50°C.
This indeed reduced the burned number of motors but it did not stop it and it increased the “cooling time” dramatically.
So I added blowers to decrease the cooling time. As I do not want blowers on the final robot I decided to increase the power of the motors. The idea is that increasing the power of the engines decreases the need for heat dissipation.
My current motors are rated 15 watt. Assuming there are on average 3 wheels touching the ground I have 45 watt available.
As to my calculations the robot should not need only 17 watt. So I start doubting my calculations and looked for a more powerful motor; preferably a brushless (as those do not loose power when running lower speeds). However the amount of 15+ watt motors on the market seems so small I can’t find them.
Conclusion: Something must be wrong.

I tried to find concrete info on the influence of PWM on brushed DC engines but didn’t find convincing material. So I decided to do some tests myself.
The first test I’ll share with you is with the engine only loaded with the gearbox and without shielding (I mean without a metal case to keep dirt away from the motor). I used arduino prescalers 1 to 5 which means pwm frequency 31000 Hz, 4000 Hz, 490 Hz, 120 Hz and 30 Hz.
I also used my arduino eclipse plugin with the scope functionality.
The test makes one motor runs at 160 PWM. Every second the temperature is taken and plotted. This 500 times so a line is 500 seconds (or 8.333 minutes)
Channel 0 is prescaler 1 is 31000Hz. the engine was 24°C when the test started and it rose to 29°C that is an increase of 5°C.
Channel 1 is prescaler 2 is 4000Hz. the engine was 24°C when the test started and it rose to 29°C that is an increase of 5°C.
Channel 2 is prescaler 3 is 490Hz. the engine was 24°C when the test started and it rose to 32°C that is an increase of 8°C.
Channel 3 is prescaler 4 is 120Hz. the engine was 24°C when the test started and it rose to 37°C that is an increase of 13°C.
Channel 4 is prescaler 5 is 30Hz. the engine was 24°C when the test started and it rose to 44°C that is an increase of 20°C.

Even with the experimental setup I feel the conclusion is: the higher the PWM frequency the better (that is in arduino world). from 4000Hz onwards there is no improvement to be seen with the test case but there is hardly any load during the test.
The default Arduino PWM frequincy on pin 3 is 490Hz (prescaler 3). Changing to presscaler to 1 seems a good idea.

I also did the test with a metal casing around the motor to protect the engine from dirt. All other parameters are the same.

Channel 0 is prescaler 1 is 31000Hz. the engine was 25°C when the test started and it rose to 28°C that is an increase of 3°C.
Channel 1 is prescaler 2 is 4000Hz. the engine was 23°C when the test started and it rose to 28°C that is an increase of 5°C.
Channel 2 is prescaler 3 is 490Hz. the engine was 24°C when the test started and it rose to 32°C that is an increase of 8°C.
Channel 3 is prescaler 4 is 120Hz. the engine was 24°C when the test started and it rose to 36°C that is an increase of 12°C.
Channel 4 is prescaler 5 is 30Hz. the engine was 24°C when the test started and it rose to 45°C that is an increase of 21°C.

so from these tests it looks like the metal casing is not relevant. But the PWM frequency is. Due to a bug I used the prescaler 3 (with is the default). With a unloaded motor reaching 44° in 8.333 minutes I think I found the issue.

Field tests have shown the issue has been tackled.

The serial monitor of the arduino connected to your yun on your local telnet

Arduino sketch experiances Posted on Thu, September 19, 2013 01:58:16

So yesterday I failed to have my arduino duemilenove connect to linino. I spend all day trying to find out what was wrong.
I’m not going to bother you with how hard it was for me to solve this and simply tell you what you need to do.
Basically the problem was that linino does not come with the usb acm driver. You can install it via the web or via the command line.

opkg install kmod-usb-acm

This works with UNO, mega, mega adk, due
But it does not work with duemilenove and I could not test the leonardo (I guess due to the dual com port issue)
While you are at it also install minicom. This is a serial monitor that allows you to connect to your arduino.

opkg install minicom

reconnect your arduino to the com port and run

ls /dev/ttyA*

you should see ttyACM0

If you see it run
minicom ttyACM0
This command will not connect you to ttyACM0 but it will use the configuration file ttyACM0. So if we configure minicom correctly the next time we run “minicom ttyACM0” it will connect to ttyACM0.
The configuration is as follows
press ctrl+A->O select port settings and then set the baut rate to the rate you usually use and the port to /dev/ttyACM0
Save the settings in the config file.
exit minicom
ctrl+A -> x -> yes
restart minicom
minicom ttyACM0
and now you have a serial connection to the arduino connected to the usb port of your yun.
If you have ssr_demo_part_2 running from one of my previous parts you see the logging flow. you can use SET to see the values you can set and everything else I explained.

But lets take it a bit further. After all you need to start putty, start minicom in putty. Why not simply working locally.
To do so load the package ser2net
modify /etc/ser2net.conf
remove all the default configurations and add
Note that the last part is the baut rate of the serial monitor so I should match the number in Serial.begin(115200) of the running sketch.
run ser2net (not sure this is needed but I did 😉 )

Now start your standard telnet program on your local machine. (I use putty)
connect to your yun on port 2001 with the telnet protocol.
And you have your serial monitor 🙂

A second look at the yun.

Arduino sketch experiances Posted on Tue, September 17, 2013 15:14:29

In my previous post I stated I had to plug the yun in and out a couple of times on windows to get it to work. I didn’t go into the details and I guess I should. So here I go.

I plugged in the yun and then started to download the arduino ide. Because I had plugged in the yun Windows wanted to install drivers.
I opted to keep the driver installation window open until the arduino IDE installation was done because I need 1.5.4 installed for the yun drivers. I started the Arduino IDE installation as soon as it had downloaded.
The installation halted at some point (I mean there was no more progress) which made me suspect that there was a conflict with the driver installation window being open. I opted to close the driver installation window. This means I canceled the windows new hardware installation.
At this point the Arduino IDE installation progressed and finished a while later.
To restart the driver installation of the yun I had to unplug the yun and replug.
This restarted the found new hardware and installed the yun driver. I use yun driver in contrast to the yun bootloader driver. Just like the leonardo there are 2 com ports. In contrast to the leonardo a cold start of the yun does not activate the yun bootloader com port and as such the cold start does not install the yun bootloader driver.
So when I wanted to upload my sketch the yun is reset and windows finds new hardware and wants to install the yun bootloader drivers.
Not really aware of what was going on I selected to cancel the driver installation. I don’t exactly remember what avr dude did at that time but I decided to unplug the yun to get back to normal behavior.
Then I tried to upload again. Again I got a “new hardware found” and this time I decided to install the drivers. However avrdude didn’t take this good as well. So after the driver installation I had to unplug the yun again to get back to normal.
But then all was fine.
In the yun guide at “” it states that the drivers should be installed but apparently in my case they were not. I’m not blaming anyone I just noticed they were not.
The yun doc also states that the bootloader is started when pressing the reset button next to the ethernet connection. I could not try whether this works as I already installed the drivers.

In my previous post I also noted that minicom package was not available for the yun. However it is available. After selecting “update list” from the web interface I could install minicom.

2 yuns at the same time.
Todays first challenge is to get the 2 yuns working at the same time.
Eager to connect 2 yuns I start looking for a usb cable which I know I have. After looking for a long time I come across a mobile phone charger and I think: “He; this should do”.
So I power the yun with a mobile phone charger with mini USB. Remove all network connections from my system. Connect to the yun access point. and go to arduino.local. And it all works :-). After configuring the yun and reconnecting to my network I can access my yun with [myYunName].local.
No connection problems and 2 com IP ports for the 2 yuns in the arduino IDE.
I upload blinkwithout delay with a 5 second interval. It all magically works. This is the first Arduino I upload a sketch to which I never connected to a PC.
Great work Arduino team 🙂

Connect an arduino mega to the yun.

The second challenge is to connect an extra arduino to the yun. This is what i would call advanced usage.
I took a duemilenove that has the uno bootloader for the first trial. (Read the duemilenove was lying next to me.)
I connected it to the usb port of the yun and it powered up. So far so good.
However dmesg reveils there is no com port associated with the arduino.
[ 2325.260000] usb 1-1.1: new full-speed USB device number 5 using ehci-platform
[ 2325.390000] usb 1-1.1: New USB device found, idVendor=0403, idProduct=6001
[ 2325.390000] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2325.400000] usb 1-1.1: Product: FT232R USB UART
[ 2325.400000] usb 1-1.1: Manufacturer: FTDI
[ 2325.400000] usb 1-1.1: SerialNumber: A9007TX5

Trying to add a udev rule shows there is no udev folder in etc. So I installed the udev package (I used the web interface).
Reconnecting the duemilenove and dmesg gives the same result.
I created the file /etc/udev/rules.d/46-arduino.rules with following content (as described on the playground
BUS==”usb”, SYSFS{idVendor}==”1b4f”, SYSFS{idProduct}==”9204″, RUN+=”/sbin/modprobe cdc_acm”
BUS==”usb”, SYSFS{idVendor}==”1b4f”, SYSFS{idProduct}==”9204″, RUN+=”/bin/sh -c ‘echo 0x1b4f 0x9204 > /sys/bus/usb/drivers/cdc_acm/new_id'”

i disconnect and reconnect the duemilenove but nothing changes.
I check the file /sys/bus/usb/drivers/cdc_acm/new_id and see it does not exist.
even the folder cdc_acm does not exist. When I try to create it I get
root@testyun:/etc/udev/rules.d# mkdir /sys/bus/usb/drivers/cdc_acm
mkdir: can’t create directory ‘/sys/bus/usb/drivers/cdc_acm’: No such file or directory

I think I’m out of my depth and need forum help smiley.
To be continued

A first look at the yun

Arduino sketch experiances Posted on Tue, September 17, 2013 01:05:49

Today my yuns arrived. It is late but I want to get it a feel of it. So this will be a short first impression.

I downloaded and installed Arduino IDE 1.5.4 on my system beforehand so I start with plugging in the yun and …. no com port.
OK; I never got the leonardo to work on my linux (redhat 6.4 ) so I can’t blame the yun for that.
Switching to windows XP virtual machine means downloading the 1.5.4 (again). I picked the uninstallable package.
During the download I can read up from

I read that starting the yun for the first time makes it work like a wireless access-point. So I try this; I could not connect the first time. The second time It worked. Once connected nothing happens. What url to use when I fire up a browser?
The description (till now?) didn’t show a url or ip adress. running ifconfig in a terminal (ipconfig for windows people) showed my ipadress. Changing the last number to 1 and we can point the browser to the yun using

And there; I am requested to enter a password. I don’t have a clue.
More reading to be done 🙁 (Advice to arduino team: move the connection stuff more to the top of the article)
And more reading reveals the url should be http://arduino.local but the ip is fine as well. The password is arduino (why didn’t I guess this?).

The yun needs a really long time after I pressed login.
Which is normal as I disconnected the yun as the installation on my windows VM seemed to be blocked (and it did continue after unplugging) 🙁

So plugging the yun back in; reconnected to the yun wireless interface.
Configured the yun and hurray!!! I can access the yun remotely 🙂
After pressing configure there is an advanced configuration that is powered by luci. This means LUA is running on the yun smiley. I have some LUA scripts so this is good news for me.

In the advanced configuration I can see that avrdude is installed 🙂 and there is still 7.14MB free. This together with the sd card makes a whole lot of storage. It looks like yun will meet my expectations 🙂
Looking through the packages I see that minicom is not one of the installed packages and also not in the available list.
I’m used to running minicom (a serial monitor) on openwrt but that package is not available. There is probably something else.

Lets try to connect to the yun in linux over the network (overcoming that Leonardo is not working on my linux)
But this one fails.
The port is visible on my windows VM though.
After unplugging the yun a couple of times trying to get the 2 drivers properly installed I can upload using the local com port on my windows xp vm. Uploading through the networks works immediately. smiley
Looking at the yun forum at I see that UDP remote port 5353 is needed. Adding this rule to my firewall on my Linux system makes I can upload to the yun remotely from my Linux system.

The first impressions are really good. I say : Very well done Arduino team.
Tomorrow I want to try
2 yuns at the same time
Connect an arduino mega to a yun
Upload my robot scripts and make it work
Lets hope it all works.

Next »