Tuesday, December 27, 2011

A £10 Tiny Basic Computer you can build yourself


Back in August 2010, I came up with the idea of a DIY Arduino built from a few components and an AT mega built on stripboard for about £10.

Just take an ATmega328 pre-programmed with the Arduino bootloader (from CoolComponents, Farnell etc) and build it onto a small scrap of stripboard about 50mm square, with a 16MHz crystal, a few capacitors, resistors and a 6 way header strip to accept a programming cable - and for about £10 you have a little Arduino compatible computer on which you can run real control programs.

If you then load Arduino Tiny Basic onto the microcontroller, you have a device that you can program in a very simple programming language - direct from a serial terminal program, and use it to flash LEDs, make light chaser displays, make analogue sensor readings and a whole load of other stuff - just with a few lines of Basic code.

Tiny Basic is a very simple to learn language and is ideal to teach newcomers the fundamentals of computing. This makes it ideal for youngsters and students who perhaps have had no experience of real computer programming.

In this minimal form, the ATmega328 has 12 digital output lines and 6 analogue inputs - plus the two signal used to support the serial terminal interface.

I hope to release a very low cost pcb and kit of parts for this in the New Year - allowing anyone to make a £10 computer.



Happy New Year

Sunday, December 25, 2011

More Tiny Basic - the plot thickens

Since finding Tiny Basic for the Arduino yesterday - by the powers of Twitter and being well connected to some very clever programming pals - we now have the digital and analogue input and outputs working - thanks @ceejay for adding this functionality.

So its now possible to flash LEDs from a simple basic program - so there is now temptation to write a Christmas lights chaser routine with a handful of LEDs and a few lines of code.

I have started a Tiny Basic Wiki page for anybody to put up their contributions, updates and improvements.

What I love about an interpreted language like Basic - is that you don't have to go through the edit-recompile-upload process - you can change your code as quick as you can type a new line and type run. This means that it is very quick to change variables, like loop parameters, delays, threshold values - without having to spend 3 minute going through the previous cycle.

This immediacy of changing how your application work with a change to a single line of code is what really appeals - it makes programming a lot more fun. And this could be very important if you are 7 years old with the attention span of a goldfish.

Tiny Basic running on the Nanode or Arduino is proving to be very quick. I think my generation that grew up with 8 bit home computers, had the attitude that Basic was slow - and perhaps it was on a machine clocked at 4MHz or under - where the cpu was doing a lot of other stuff at the same time. This cut down version of Tiny Basic is lightening quick on a 16MHz ATmega328.


I noted a few benchmarks whilst running the serial terminal interface at 115200 baud:

1 million FOR - NEXT loops in 45 seconds
10,000 10 -bit ADC reads and printed in 7 seconds, 4 seconds if you don't print them.

The plan is now to start a Wiki page so that others can contribute to the Tiny Basic project, add new functionality and extend the usefulness.

On the Nanode we now have a rich set of peripherals and interfaces. Making use of the micro SD card as a solid state drive for loading and saving programs is an obvious choice. Some better editing features would make code entry simpler - and of course having interactive coding via a web browser is a goal for the near future.


Happy Christmas




Ken

Saturday, December 24, 2011

Tiny Basic running on Nanode - Christmas Challenge

This is something I have wanted to do for some time - run an interpreted Tiny Basic on the Nanode - so that newcomers can program it quickly and easily.

This would make Nanode a lot more accessible to novice programmers - and could have an important role to play in helping to teach kids the basics of programming and computer science - just like we learned 30 years ago - on simple 8 bit machines running basic.

A Nanode as a web connected platform sells for just £25, or fully built, tested and expanded to include micro SD card, Realtime Clock and wireless transceiver for just £40. (That happens to be what I paid for a ZX81 kit in 1983).

The latest Nanode really is evolving into a small computer system, with it's 32K SRAM and the micro SD card. There should be the means to run programs out of these memory devices, and use the SD card like a hard disk for file storage and retrieval - and tasks such as datalogging.

The first task was to find a program which can be used like an operating system - in order to tie all the various hardware functions and libraries together.

Tiny Basic hails from 1976, when the Homebrew Computer Club of Menlo Park - in Silicon Valley were looking around for a simple and compact interpreted language that would run on their homemade Altair 8800 machines - and did not want to pay the young entrepreneur William Gates $150 for his version of basic. So a challenge went out to the members to write their own - and several did, the most notable was Tom Pittman.

http://www.ittybittycomputers.com/IttyBitty/TinyBasic/index.htm .

Tom's original code has been adapted for many different platforms over the years - some written in native assembly language and some ported to C - so that it might be platform independent.

I recently was made aware of an assembly language version that compiled on an AVR (eg ATmega328) into under 4K - but modifying this code was going to be a little to intense for most people - so I was delighted to see that Mike Field had taken the generic C version and updated it so that it can run on an Arduino - or Nanode - without modification. Mike's working port of Tiny Basic - written in C, compiles into just under 7.8K on a standard Arduino. If you crank the baudrate up to 115200 - it is surprisingly quick at executing.

http://ec2-122-248-210-243.ap-southeast-1.compute.amazonaws.com/mediawiki/index.php/Arduino_Basic

As it's written in C, and uses simple tables of tokens or keywords, it is easily extendable to write new keywords and functions which exercise the Nanode hardware. Additionally there is plenty program space left - about 22K, into which the various library functions for ethernet, SD card, RTC, MAC and SRAM may be added.

Whilst it currently executes code from internal RAM, this could probably be redirected to the external 32K SRAM - into which we can TFTP a simple basic program listing - or access the SD card - which we can use as a local repository or "juke box" of our favourite sketches.

Extending this Tiny Basic and including the common Arduino libraries to form an Nanode operating system (NanOS ?)will be an interesting but achievable task.

The Tiny Basic plus all the nex=cessary hardware libraries fit into just 13K of program space leaving 17K for language extensions and application code. The breakthrough will be to get the SRAM and the SD working as a program application memory and solid state disk.

With the Tiny Basic is a means to list the program, so that lines of code can easily be edited with a terminal program. - or probably a whole file loaded using a file transfer program such as Hyperterminal or whatever.

A simple text editor could also be used to edit and manipulate html text, stored on SD or SRAM - so that web pages could be locally edited and then displayed on a browser.

The Tiny Basic is certainly fast enough to be usable, especially with the baudrate at 57600 - I did 10,000 iteration loops of

10 For A = 0 to 9999
20 Print "My Name is Joe"
30 Next A

In just 30 seconds - anyone who remembers the early 1980s machines like the Spectrum will appreciate this is several times quicker.

It should be straight forward to get the Nanode (Arduino) I/O pins accessible from basic keywords - perhaps something like defining each pin as a keyword
to set Digital 4 High. As there are only 20 I/O pins on a ATmega - it's not going to take much program space to code them up. eg

10 Let D4 = 1 // Set Dig 4 High
20 Let A = AN1 // Get input from Analogue 1


Lots of simple hacking fun for the Christmas holiday - and if you are old enough to remember the Spectrum - this should be like child's play again.

So here's the challenge - download Arduino Tiny Basic from here

http://ec2-122-248-210-243.ap-southeast-1.compute.amazonaws.com/mediawiki/index.php/Arduino_Basic

add in the various Nanode hardware libraries: Ethercard, wire, SD, NanodeMAC, RTC, Ports , RF12

And the best Nanode/WiNode Tiny Basic hack by New Year - wins a pair of fully expanded Winodes - or a pre-assembled Nanode XRF and a WiNode. - worth £60.

Happy Hacking Chrismas



Ken


BTW
The new Nanode website www.nanode.biz will be fully operational in the New Year. Check it out to see our greatly extended range of Nanode and WiNode products.

Saturday, December 03, 2011

Testing Nanode RF - 4 simple test sketches

Nanode RF should be tested in simple steps.

Before you fit the RFM12B module and Magjack, fit the ATmega328 and the 74HCT125 ICs and apply power via the programming cable.

The red led should wink at approximately 1 second intervals.

Ian Chilton has subsequently made these test sketches available on Github - because code does not travel well in these blogs - getting corrupted by the formatting codes.

https://github.com/ichilton/nanode-code/tree/master/test_rfm12b

https://github.com/ichilton/mcp7941x_arduino/blob/master/examples/RTC/RTC.pde

Now cut and paste the following italicised code into a new sketch and check that you can load it. On reset the Red and Green LEDs will flash alternately. This Blinky sketch shows that the ATmega is running and that the upload process is working.

Include below are the LED test, the RF send test, the RF receive test and the Realtime Clock test.

The RFM12 module and 82mm antenna should be soldered in place after you have run the LED test. Make sure you fit the 74HCT125 - because the /INT line from the wireless module passes through this buffer.

Building blocks for the Internet of Things.

Open Source Hardware Building Blocks - Lego for the Internet of Things.

Nanode RF - A Web Connected "Arduino Like" Board with Wireless Connectivity for £30

Three years ago exactly, I first got interested in web connected devices. I bought a £100 dev-kit from Microchip, loaded a few examples, but frankly found the technology poorly documented and with a very steep learning curve, I admit I made very little progress.

Undaunted, I took a new job in central London, met a whole host of people with similar interests, through HomeCamp, Pachube, London Hackspace and Minibar and was inspired to develop some of my own ideas into commercial products.

The idea of being able to connect bits of hardware - like sticking Lego blocks together - had a huge appeal. The open source Arduino was trailblazing ahead with a low cost platform and gaining a huge momentum of users and developers. It seemed sensible to produce a compatible platform which is built on the foundations of the Arduino project but adds a whole bunch of new network connectivity functions. Thus was born Nanode - Arduino's well connected cousin.

This week sees the launch of two new product offerings in the Nanode family.

Nanode RF is a much updated Nanode which includes a low power wireless transceiver module - allowing it to communicate with similar networked devices - whilst retaining web connectivity.

Nanode RF also has a real time clock/calendar which can be used to wake up the board at certain times to perform given tasks.

The 32K x 8 static RAM, provides a useful buffer space for storing larger web packets, and also provides a means of upgrading the Nanode RF firmware via the web using a TFTP server.

On the underside of the pcb is a micro SD card socket. This allows a huge amount of external storage - can be used like a disk drive, for holding a repertoire of web pages or as a store for vast quantities of datalogged information.

Nanode RF has conventional Arduino shield connectors, and like Arduino provides a variety of analogue, digital and PWM I/O Pins.

Like the Nanode 5 predecessor - Nanode RF uses predominantly through-hole construction, and may be built form a kit, with a simple pictorial assembly guide and basic soldering skills.

Nanode RF can also be purchased as a fully built and tested board - the Nanode RFX is a maxxed out board with all options fitted.

To complement the Nanode RF - who's role is that of an ethernet connected gateway or basestation, we also introduce a low cost sensor/actuator node: WiNode is a low cost wireless node aimed at networked wireless control, monitoring and actuation applications.

WiNode is also available as a kit, and retains much of the functionality of Nanode RF, but without the ethernet connection.

WiNode - A Wireless Network Sensor Actuator board - based on Arduino technology.

WiNode has four analogue inputs - buffered for voltages of up to 18V, and four high current (2A) digital outputs. These signals are accessed through the easy to connect screw terminals.

The high current outputs may be used for speed control of 2 dc motors, or high current loads such as relays or high brightness LED lighting. The 4 outputs can also be used to drive a single stepper motor.

WiNode also features the familiar Arduino shield connectors, allowing a variety of expansion hardware to be added.

WiNode has the 32K x 8 SRAM, the real time clock/calendar for task scheduling, and when fully populated will accept the micro SD connector for stand alone datalogging applications.

Unlike Arduino, the Nanode and WiNode products do not have the serial programming IC on board. Instead we have produced a customised budget programming adaptor. This allows automatic programming of Nanode products using the Arduino IDE software environment.


Nanode and WiNode products can be purchased online. We currently accept orders by PayPal.

Check out our www.nanode.eu website

Kits:

Nanode 5 - the original - discounted stocks - a few still remaining £19.25 +£0.75 P&P
Nanode Classic £25 - RF module not included - but can be added later (£5.99 Maplins)
Nanode RF £30
Nanode RFX £40 - fully built and tested board

Basic WiNode - from £25

Pre-Asembled and tested:

Nanode RFX - fully assembled and tested £40
Nanode USB programming lead £5.

For more details, contact me, Ken Boak at nanodenanode at gmail dot com

Nanode products are fully Open Source and ethically produced by Arbour Wood Limited - by a collaborative team of friends based in the UK, New York and Shenzhen, China.