How to add a console to your Serial port in Eclipse

I didn't find any way to make a console work efficiently with my fresh "Eclipse for Arduino" installation, so I decided to find a work around to launch it. First thing is to get PuTTY. Then, put this little bash file I made wherever you want (the file extension must be .bat).

[source lang="bash"]

@echo off
REM Check for user inputs
if "%1"=="" GOTO BadArgs
if "%2"=="" GOTO BadArgs
if not exist putty.exe GOTO BadPuttyInstall

REM Local variables.
SET PUTTY_SETTINGS=ArduinoSettings
SET COM_PORT=%1
SET /a BAUD_RATE=%2

REM Modify registry keys for modifying the putty settings.
@REG ADD HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\%PUTTY_SETTINGS% /V SerialLine /T REG_SZ /D %COM_PORT% /F > NUL
@REG ADD HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\%PUTTY_SETTINGS% /V SerialSpeed /T REG_DWORD /D %BAUD_RATE% /F > NUL
@REG ADD HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\%PUTTY_SETTINGS% /V Protocol /T REG_SZ /D serial /F  > NUL

REM Load the setting with putty.
echo Launching Serial console (PORT %COM_PORT% ; BAUDRATE %BAUD_RATE%)
putty -load %PUTTY_SETTINGS%
echo.
goto EndProg

REM Error management.
:BadArgs
echo.
echo Problem with number of arguments. For example : COM3 9600 ; COM2 115200.
goto EndProg

:BadPuttyInstall
echo.
echo Could not find Putty. Make sure that the working directory contains it.

:EndProg

[/source]

(Be aware that this script makes modifications in your registry, so make sure you know what you do).

Next we'll integrate it into eclipse.Go to Run>External Tools>External Tools Configuration. Create a new configuration. In the main tab, in location, indicate the path to your bash file. As a working directory, select your PuTTYdirectory. As arguments, put first the name of the port you want to connect to, and then the baudrate (for example you'll have COM2 9600 ; or COM12 115200). In the "Build" tab, uncheck "Build before launch".

You can launch this by clicking on the icon next to the "Run Project" (it's a little green arrow with a brown toolbox).

If you want to change the console color/aspect (typically, I like to have it in front of all other windows), just run PuTTY, load the "ArduinoSettings" settings, modify it as you want, and save it.

Hope it will be usefull !

How to use Arduino with Eclipse

Complete explanations : http://eclipse.baeyens.it/

Why changing the IDE

If you're familiar with the Arduino IDE, you will agree that it's not very convenient to use. For exemple, you won't be able to do multiline tabulation, autocompletion and advanced programming tips in general. Well here's the good news : you can use a very powerful IDE, Eclipse (well known by Java developers) to make your Arduino developpements. This article is meant to help you doing this.

Downloads

First, download the Eclipse IDE. Be sure to choose the C/C++ version, not the Java's one.Then, you need to download the Arduino IDE. It will get you access to the compiler and the core libraries.

Configure Eclipse

The first thing to do is to launch Eclipse IDE.If Eclipse tells you that JRE is missing, you'll have to install it manually. If you are running Windows 7 64bits, download the specific 64bits version of this JRE, otherwise it won't work.

After Eclipse has started, you'll be prompted for a wordspace folder, select wherever you want to save your future projects. Personnally, I've a root folder "EclipseForArduino" where are located Eclipse IDE, Arduino IDE and my workspace.

Ok, now you have to install the Eclipse extension for using AVR compilers. Go to help>Install new software. In the "Work with: " field, type http://www.baeyens.it/eclipse/update site/, and then select the Arduino eclipse extensions software. Install it, then restart Eclipse. You'll have a new menu item "AVR". Lets configure it with Window>preferences, Arduino tab , Arduino>Arduino Settings for this workspace. Put your arduino IDE (for me : D:\EclipseForArduino\arduino-1.0.1. Check "Use Arduino IDE tools in eclipse".

Click Apply, and go to the "Paths" tab to check if everything's ok (except for the last one, which is not important).

In AVRDude, the "Use custom configuration file for AVRDude" checkbox must be checked, and filled out with the avrdude.conf file from Arduino IDE.

OK, now you should be able to create a new project : File>New..>Other.. ; select Arduino>New Arduino Sketch. You'll have to select your serial port and board revision.

To avoid problems while using Serial ibraries (typically, Eclipse says there are bugs when you use Serial, but you still can compile it) :

windows->preferences->C/C++->indexer->index unused headers.
windows->preferences->C/C++->indexer->index source and header files opened in the editor.
windows->preferences->C/C++->indexer->Files to index upfront . Add arduino.h and or WProgram.h.

To import a library in your project, simply right click on it, then select "Import...", and "Import a arduino library in the current project". That's almost it. If you have some problems, first review the official plugin support site (I gave a link to it at the beginning of this article).

Export/Import your Arduino project

How to import an existing project, lets say, to an other computer ? First there are 2 prerequisites to make it possible :

  • The needed libraries must have been placed in the folder specified under plugin preferences
  • In additiont o the sources, .project and .cproject files must be present in the sources folder. Without those files, you'll have to manually import the needed libraries.

The steps of import procedure are :

  1. In Eclipse, choose the existing project import.
  2. Check that the plugin is well installed. The included libraries must be in the good folders (check both core and personal libraries)
  3. If the board you want to use is not il your existing projects, create a new Arduino project to generate it. You can next delete this newly created project as the board project wil stay.
  4. Under project preferences, Arduino tab, select the newly created board.
  5. Import is now over. One can continue to work on the project.

Stellarium : Best software for astronomy purposes ?

What is Stellarium ?

A general view of Stellarium GUI

One question a novice could ask is : what do one use as a map to find stars, or even to control a telescope ? After we completed the PIC-ASTRO, the first thing we wanted to do was to make it work with the awesome astronomy software Stellarium. Indeed, Stellarium seems to be the best out there for some reasons :

  • It's beautiful compared to its concurrents : it may be a detail for one, but I think that if you must spend time on a software, at least it should be Pleasant.
  • It is really really simple to use, in comparison with other planetarium softwares
  • Also, interfacing telescopes is a simple task.
  • It's free, and an opensource project, new releases are made constantly and the source code can be modified (and believe me, we will), and it's relatively easy to write plugins for it.

Customize your environment.

The first thing to do is set your current location. Open the location window (F6). There, you can select a town, or create your own village by filling the coordinates field. Easy, isn't it ?

Localisation window

You're able in Stellarium to make a lot of adjustments to make it match what you can see in the sky. So stellarium let you, for example, customize the light pollution amount, the degree of star's twinkle, etc. Press F4 to get the customization window.

Customization window

Not enough stars for you ? Well, Stellarium comes with a pretty light stars catalog (which still includes most of the stellar objects you need), but this catalog can be extended for like six or seven times, so don't worry, the object you're looking for should be there. Press F2 to access the configuration window, and update your star catalog as you want in the tool tab. Still not in the sky after all catalog extensions ? Okay, you can add it manually to find it out next time. As I said, awesome soft.

Configuration window

Okay, now you want to see a stellar object, let say Orion Nebula. Try to find it in the view. You can also search it by name with the F3 shortcut. If you zoom on it, you'll the the rotation of the earth makes the nebula want to get out of your screen. If you select your nebula, and click on space button, it will force the Stellarium view to track the object.

Great nebula in Orion

Interfacing Stellarium with a telescope

Here, a nice plugin has been implemented to help you doing that. First, you have to activate it in the options (F2 - plugins - Telescope Control - Load at startup). Then, you restart Stellarium and tell it what kind of device you have (for us, it's a pic-astro, so LX200-compatible). The shortcut is Ctrl-0(zero), or you have a new icon in the horizontal bar next to night mode and full screen mode icons. The first time you connect your telescope, and after starting the connection, you may want to synchronize it with Stellarium, with a star of your choice. Nothing easier, select the object, press ctrl-1 (1 is the index of your telescope, if you have multiple devices connected), and it's done ! Next time, if you want a goto on Procyon, just select it, and use ctrl-1. You're telescope should now move in direction to Procyon !

I tried in this article to present Stellarium. But there is still a huge amount of features I haven't talk about, like the possibility to time travel. You just should try it, you'll see yourself how easy it is to use. And even if you don't have a telescope, just for the beauty of the sky, it honestly worth it.

Actually, even if Stellarium is one of the greatest soft I ever used, we wanted to add other features for telescope control, to increase the Pic-Astro integration in Stellarium to its maximum. This will be the object of an other article, since it will be a little more tricky.