Thursday, 28 April 2011

Using Notepad++ with Arduino sketches

After using both the Arduino IDE and VB express I'm always a little disappointed at the lack of helper features in the Arduino IDE, of course it is a little unfair to compare the two when you consider the differences in available resource! the Arduino IDE is still pretty good.

Functions contracted
I have used Notepad++ for some time as a general text editor on my PC and I thought I'd give it a try as an editor for my pde files.

Well I think it's brilliant, you can get it to group things like functions and 'if' statements and, more importantly, the comments.

This makes it much easier to navigate and edit your sketch as you can view it as a list of minimised comments and functions and expand each one for editing as required.

There are shortcuts which allow you to expand all, at different levels.

Another good feature is the automated colouring of key words and you can even add your own key words.

With Arduino set to external editor this gives a much more user friendly interface I realise there are other options to get a more professional UI, like Eclipse etc but this is a lot easier to set up.

Sunday, 17 April 2011

Shield data

Just a quick note, a friend sent this link to me for Shield information.

It contains a list of loads of Shields for the Arduino along with information on which pins they use and which are still available.

Thanks Nick.

Wednesday, 13 April 2011

Set the time on your DS1307 with the Arduino

After getting my DS1307 RTC working I thought it would be easier to set the time using an app (can I call it that?) on the PC that uses the PC time.

The code base that I used/modified to read and write to my DS1307 was from here, this uses a UNIX time code to set the time.

The app should be used in conjunction with this Sketch, or derivative that uses the same method to set the time.  You can also see any serial data sent back from the Arduino in the 'data received' window.

Now I'm not an expert in VB programming but I like the occasional challenge so here it is, please use it and modify it as you like, I got most of the instructions using Google anyway.
The idea is that the computer time is split out into the separate boxes, not necessary but clearer for me to programme.

The 'T' box continually updates to create the UNIX time code and is sent to the Arduino/RTC when the 'Send' button is clicked.

To install the App: -
  1. Get it from my dropbox public folder here.
  2. Extract to a folder on your PC.
  3. Run the setup to install.
  4. Run the programme.
  5. Select the comm port (plug in Arduino first).
  6. Select the baud rate to match the Arduino.
  7. Click Connect.
  8. Click Disconnect before exiting the app.
Any problems or suggestions please use the comments.
23/4/11 - Post updated - Link to Arduino sketch corrected.

5V from 3V with Energizer

Some time ago I saw some Energizer emergency phone chargers for sale in a local cheap store, these were £1.99 each (usually £12.99, I think) anyway I bought several of them because the batteries that came with them would cost more than £2 for two. (not the ones shown in the picture)
Some time later it dawned on me that these were basically step up converters, 3V to 5V!

So I turned this
As it comes ..

Into this

Emergency charger with USB cable added
A portable 5V supply for anything with a USB power plug, I've also seen single AA emergency phone chargers and I suppose these will do just the same.

You can prise apart the body of the charger (there are clips inside that will release, with some teasing) and remove the 3.5mm socket from the circuit board inside the top silver part then the hole left was just the right size for the USB socket and lead I had lying around from another project or you could use a power tip for the other supply connecter for the Arduino.

Remove 3.5mm Socket (right) and add cable (left)

You could also remove the small circuit board and use it with another battery holder or even inside your final design.

Due to the higher mAH rating of the AA batteires I think they will last a lot longer than a PP3 9V battery.

Saturday, 9 April 2011

JeeLabs JeeNode

Whilst looking around the net for information on the Arduino project I come across a few variants on the theme, this one struck me as particularly useful.

This site is run by a guy called Jean-Claude Wippler, he has created his own version of the Arduino called the JeeNode.
JeeNode V5

This derivative of the Arduino is a much slimmer device, intended to form part of an environment monitoring network around a house, the main thig about this design is that it includes a built in wireless transciever which allows these things to talk to each other without having to buy an Xbee board for your Arduino. (You can get two of these for not much more than one Xbee)

It uses the same programming IDE as the Arduino.

The pinout interface for the JeeNode is quite different to that of the Arduino, he has setup 4 ports that can be connected to various sensors like temp, humidity and many more using I2C.  To make programming easy he has also built a ports library.

The wireless interface is also made easy to use with a custom library, this enables you to send and recieve serial data without worrying about any data protocols at either end.  Each device comes pre-programmed with the libraies needed and can talk to each other out of the box, all you need to do is follow the tutorials on the site.

The other thing that interests me, when combined with the wireles capability, is the nice graphical LCD screen.
Graphical LCD
 The Screen comes with a PCB that plugs onto the JeeNode and along with a single AA battery holder/stepup invertor you would get a complete wireless screen showing information from the main unit and even sending data back.

Complete Wirelss screen
The one thiong you'd need to get though is a FTDI programming lead because, unlike the Arduino, it doesn't have the USB programming interface. I found mine here.

I found all this at Jeelabs, based in the Netherlands.

Tuesday, 5 April 2011

Arduino Project

Project layout - Click for larger image
This is the layout of my project so far, it includes a 4 line 20 character LCD, an DS1307 Real Time Clock module and a DS18B20 Digital temp. sensor.

The idea is to control my central heating with a bit more user friendliness so there is the LCD to display information and I'm also writing a PC programme to interface via the USB lead to the Uno, this will allow a graphical interface to set on/off times, temperature profiles based on time of day, outside temp., water temp. and room temp.

All this is quite far off at the moment but so far I've integrated SW from various sources to initialise and read the Temp sensor and RTC and drive the LCD.

Main Components
  • Firstly the Arduino Uno purchased from coolcomponents 
  • Temp Sensor - DS18B20
    This temp. sensor is slightly different than the ones I've used before, instead of it being an analogue sensor with so many mV per Degree C it is a digital device that coverts the temp to a digital value within the device and can be converted in code directly to a temp. reading.  There are a couple of other advantages to using this device, it can be used over a relatively long distance without any calibration issues and it can be used in two wire mode.  This also came from coolcomponents.
  • Real Time Clock - DS1307
    This module uses a RTC IC, two pull-ups and a 3V Lithium battery (which should last 10 years), this was sourced off Ebay.
  • 4x20 LCD - I had this in my box of parts but they can easily be found on Ebay.
Project so far
 More later .....

Monday, 4 April 2011

Arduino - Open source hardware and software platform

I've just discovered the open source HW and SW platform called Arduino, this platform allows inexpensive prototyping of your ideas.  Your Ideas are called "sketches" and are similar to the C type programming language, not that I've done any programming in C!

The Arduino range includes several different types of processor/PCB arrangements from the "UNO", which I bought, to the very small "Nano".

The Nano

The software "Sketches" are written in an open source IDE, available from the website, this allows you to write and download the software to the target board.

The really good thing about the design is that they have all the I/O on header pins along each edge of the PCB allowing addon PCBs, called Shields, to be stacked on top of the main processor PCB, if it's an UNO or Mega, the smaller boards use DIL sockets to connect to other circuits using breadboard for example.

Due to the open nature of the whole enterprise there are quite a lot of third party addons that can be found on the Internet especially on Ebay, things like:
  • Ethernet adapter boards
  • LCD displays
  • Prototyping boards
  • Wireless adapters (WiFi, Bluetooth etc.)
  • Relay boards for switching mains equipment
  • H-Bridge motor controllers
  • Servo Controllers
  • Real Time Clock
Most of these addons come with Arduino Libraries which give simplified commands to allow quick and easy configuration of the Shields.

The UNO comes with a surface mount LED connected to Pin13 on the PCB so it is very easy to write your first programme, for example the first code to try from the Arduino site would be: -
  Turns on an LED on for one second, then off for one second, repeatedly.
   This example code is in the public domain.

void setup() {                
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  delay(1000);              // wait for a second

All you need to do is copy and paste this code into the Arduino IDE software and squirt it down to the board via the USB connection and the LED on the PCB will start to blink.

At the moment I'm putting together an Uno with a Real Time Clock, LCD display and a couple of temperature sensors to control my central heating and hot water, I'm also hoping to control it via the USB connection using a Visual Basic programme on a PC, I'll add more details to the blog as I progress.

Three button WiFi Remote

Using the power control circuit from the Wirelesse door/Window sensor I have designed a simple 3 button WiFi remote with the intention of co...

Popular Posts