Posted on Leave a comment

Arduino Nano Every (now eChook compatible!)

The eChook nano code has been updated for compatibility with the Arduino Nano Every.  Download here.


Towards the end of 2019 the Arduino Nano Every was released as a successor to the venerable Arduino Nano. This is significantly cheaper (£11 at time of writing) than an older ATMEGA328p based genuine Arduino Nano

There were two prompts for this update:

1. The ‘Cheap Chinese’ Arduino Nanos aren’t looking quite so cheap with the current chip shortage. Where they used to be available for £1.50 you’ll now be hard pressed to find one for under £5, and that’s if you’re buying a few. With this in mind it’s hard to argue against going for a branded Arduino nano compatible board, such as the Maker Nano(£7) which has a useful array of led’s and extra bits if you’re using it for development or a DFRduino Nano, which is confusingly more expensive at £9, or indeed the Genuine Arduino Nano Every, for £12.50 (£11 without soldered headers), which has the benefit of supporting Arduino development.

2. One team (you know who you are!) bought a batch of Arduino Nano Every boards for their eChooks, understandably believing the sales pitch of 100% compatible with the Arduino Nano, only to find they’re not 100% compatible at all!


Code Updates

There are two major changes required to make the code compatible with the Arduino Nano Every. The biggest change is the Hardware serial port. The Atmega328p microcontroller on the old Nanos has a single hardware serial port which is shared with the USB programming interface and the TX and RX pins that are used for bluetooth communication. This was accessed in code via the Serial object. 

The Arduino Nano Every uses a far more powerful and better featured ATmega4809 microcontroller that has multiple hardware serial ports, and uses different ports for the USB and the TX and RX pins. The USB serial is accessible through the Serial object, but the bluetooth data now needs to be sent out via the Serial1 object.

To achieve compatibility I’ve created a SerialA object and referenced it to either Serial or Serial1 depending on the selected target microcontroller using compiler directives:

#if defined(__AVR_ATmega4809__)
 #define NANO_EVERY
 // References Serial1 to SerialA for the Arduino Nano Every
 HardwareSerial &SerialA = Serial1;
#else
 // References Serial to SerialA for the Arduino Nano 328p
 HardwareSerial &SerialA = Serial;
#endif

When using the Every, data is sent to the bluetooth module, but is no longer available to the USB. On the plus side, this allows any debug messages to be sent out through the USB without them being lost in the binary data stream – a nice feature for development.

The other change involves interrupts. Every digital pin on the Every can be used as an interrupt, and when using the Arduino attachInterrupt() routine, they are identified by pin number, instead of interrupt number as on the old Nano. The same compiler directives have been used to set the interrupts depending on target microcontroller:

#ifdef NANO_EVERY
   attachInterrupt(2, motorSpeedISR, RISING);
   attachInterrupt(3, wheelSpeedISR, RISING);
#else
   attachInterrupt(0, motorSpeedISR, RISING);
   attachInterrupt(1, wheelSpeedISR, RISING);
#endif

I’ve taken the opportunity to make a few other small improvements to the code. Comments have been updated, some legacy code supporting the prototype eChook boards (v1.1) has been removed without breaking compatibility for them, and the handling of button presses has been improved making better use of the Bounce2 library features.

While there are no immediate benefits to using the Arduino Nano Every over an old Nano, it is a newer, faster and more feature rich microcontroller that could open some new avenues of development – it’s a really nice little board.

Posted on Leave a comment

Welcome to the Shop

eChook finally has a shop!

Since 2018 the eChook nano telemetry kit has been sold very successfully by Greenpower. With the limited audience that is Greenpower teams we’d not expected many sales, but we’ve been pleasantly surprised with over 150 kits going out to teams. Nothing is going to change for the kits – Greenpower will still exclusively sell them – but this store has been set up alongside to sell accessories, any new Greenpower related products we might be developing. Every Greenpower project will still be open source – the relevant links for each product will always be at the bottom of the listing.

We are also branching out from purely Greenpower related products – we hope over time to fill the store with a few niche electronics solutions and a range of 3D printed items that we’ve designed and found useful.

As a result of this branching out, the branding of the OG eChook nano will change to become the eChook GPT nano (That’s GreenPower Telemetry in case you were wondering… Can’t accuse me of being imaginative!), and the GPT moniker will be used for any Greenpower products in the future.

The shelves are looking a bit bare right now, but give it some time and they’ll start filling up.

As part of this online levelling up (sorry) we finally have a dedicated email address for eChook support: info@echook.uk
Feel free to get in touch 🙂