Versatile ATmega1284 board with Wireless, microSD card and USB interface |
Recently I have been using some of my WiNode 4 boards as general purpose "Arduino Like" dev boards, whilst working with the FT812 video board and controlling the Open Inverter Power Board.
The WiNode is a good little workhorse - but with the needs of the Open Inverter Project, I decided that it would be better to take the best parts of the WiNode and update it - so as to be a better match for the Open Inverter H-Bridge circuit - which is also on a 50x50 format pcb.
The WiNode is close enough in configuration to an Arduino, but benefits from a uSD card, an RFM69 low power wireless transceiver, some non-volatile SRAM and a real time clock.
Additionally WiNode had a dual H-bridge driver - useful for driving Mosfets, or switching relays or fans.
One of the main limitations with Arduino is the lack of SRAM - and so one of the projects on my list was to update the WiNode 4 to use an ATmega1284P (datasheet) - which has 16K of SRAM, 128K of Flash ROM, and an extra UART. The ATmega 1284P comes in a 44 pin TQFP package which has sufficient pins to give it four, 8-bit ports - so there is the benefit of some more I/O and an extra 2 ADC lines.
The WiNode 4 is a through hole kit, which makes it easy to build, but the time has come to move away from through hole designs and get the greater circuit density that surface mount packages offer. Taking advantage of my new 50mm x 50mm pcb format, I decided to spend some time updating WiNode to make full use of the additional resources available on the ATmega1284P.
Features.
The ATmega1284P is arguably the best of the small 8-bit AVR devices in terms of features. It has been described elsewhere as the "Goldilocks" of the ATmega line-up. Not ony is it available in a breadboard friendly 40 pin DIL package (the largest of the AVRs in this package) but with extra timer, interrupt, 32kHz oscillator - plus the huge by comparison memory - it is one of the most useful. It is a shame that in 2009 when Arduino launched the MEGA - that they didn't consider using the 1284P - as a "mid range" offering. This blogpost from Winter 2011 sets the scene regarding the ATmega1284.
I wanted to create a compact, general purpose Arduino compatible pcb that could be used for a wide range of applications. It would make use of the following additional features offered by the '1284P
- 32 GPIO pins - arranged as 4, 8-bit ports
- Extra interrupt input INT2
- Additional USART
- Extra 2 ADC channels - for battery monitoring
- Extra Timer T3
- 32kHz external oscillator - to implement RTC
- Extra Flash (128K)
- Extra RAM (16K)
To do this, the following hardware was considered:
- RFM69 low power wireless module - (RFM12B footprint compatible)
- Lithium battery support including boost regulator and battery charge controller
- 32K battery backed SRAM for general purpose storage
- Mini Ports - two, 4 x 2 connector with PWM, ADC and power to support other hardware *
- Real Time Clock - MCP79410 - can wake up the mcu at regular intervals.
- microSD card - for datalogging, program storage etc.
- Extra UART channel - used to communicate with optional ESP8266-01 WiFi module
- 40 pin 0.6" DIL socket to allow optional use of DIL version of ATmega1284P
Fitting all that onto a 50 x 50 pcb was a bit of a challenge - and having done the basic route by hand, I left it up to the autorouter to do the donkey work.
Whilst the ATmega 328 used in the Arduino has 6 Analogue pins and 14 Digital, the ATmega1284P has 8 Analogue pins and 24 Digital. These are arranged as 8 bit Ports A, B, D and D. Fortunately the 50x50 board format has 6 additional header pins which are used to accommodate some of the extra pins of Port C - that are not present on the smaller device.
Board Layout
The surface mounted ATmega1284P is in the centre of the pcb, and is pinned out to a conventional 40 pin DIL footprint. This not only gives easily accessible probing points for all of the pins - but also aids connectivity during pcb layout - as all of the pins are routeable from both the top side and underside of the pcb.
At the top and bottom edge of the pcb are a pair of 4x2 headers. These are to allow a pair of the experimental Open Inverter H-bridge boards to be plugged in and controlled by the '1284P. The headers are a mirror image of one another allowing one H-Bridge to be stacked below the controller, and the other stacked on top - effectively making a sandwich arrangement with the controller in the middle as the "filling". Each header carries a pair of complementary pwm signals, two analogue inputs - for current or voltage measurement and two general purpose GPIO pins for driving relays, fans etc.
The WiNode was originally designed to be a universal wireless sensor/controller board - made compatible with the JeeLabs RFM12 library and compatible with JeeNodes and the Open Energy Monitor range of devices. I have continued this approach - but upgraded the RFM12B to the more capable RFM69 - which shares the same footprint.
In addition I have also added a dual row socket to accept the ESP8266-01 WiFi device. This will allow this board to act as a bridge between WiFi and the RFM low power wireless ecosystem.
Applications
As stated earlier - this board has been designed to act as a controller for the experimental Open Inverter Project.
It's main function is to carry out the safe drive up to two H-bridges and monitor the currents and voltages when the inverter is operational. The inverter is sufficiently flexible to work as a buck and boost converter - allowing dc to be transformed.
The on board RFM69 (or ESP8266) allows the voltage, current and temperature readings to be conveyed to either EmonCMS, Emon-Pi or a wireless router.
The board is capable of being battery powered from a lithium or other (alkaline) cell - as it has a boost converter that works down to 0.6V.
The board may also be used as a stand alone battery powered multi-channel datalogger.
Circuit Description
This is all very standard Arduino stuff. ATmega1284 running from a 3V3 logic supply and running at 16MHz (- proven to work reliably - despite what the data sheet suggests).
In addition to the standard FTDI cable 6 pin connector for power, debugging and serial UART connection, there is the option of a USB- virtual serial port connection - provided by the CH340G - a low cost alternative to the FT232R.
The GPIO is pinned out in a way that is similar to the Arduino - but certain differences between the allocation of the peripherals to the ports, means that the '1284 is a little different to the '328. The pinout of the processor is below:
Main Peripherals:
Analogue Inputs: PA0 - PA7
SPI port: PB4, PB5, PB6, PB7
I2C port: PC0, PC1
UART0 PD0, PD1
UART1 PD2, PD3
Timer 0: PB3, PB4
Timer 1: PD4, PD5
Timer 2: PD6, PD7
Timer 3:
List of Allocated Signals
First the fairly standard Arduino pins - except that the Timer outputs are relocated, and there is also an extra INT2 on D8:
D0 RXD (UART 0) T3 (Timer 3 clock input)
D1 TXD (UART 0)
D2 RXD (UART 1) (ESP TX) INT0 (RFM69)
D3 TXD (UART 1) (ESP RX) INT1 (RTC)
D4 OC1B (Timer 1 Outputs)
D5 0C1A (Timer 1 Outputs)
D6 0C2B (Timer 2 Outputs)
D7 0C2A (Timer 2 Outputs)
D8 INT2
D9 OC0A (Timer 0 Outputs)
D10 SPI SS OC0B (Timer 0 Outputs)
D11 SPI MOSI
D12 SPI MISO 0C3A (Timer 3 Outputs)
D13 SPI SCK 0C3B (Timer 3 Outputs)
D14 I2C SDA ( These come from Port C and are no longer shared on analogue inputs)
D15 I2C SCL
A0
A1
A2
A3
A4
A5
These signals are in addition to those normally found on ATmega 328 Arduino. I have allocated them for general housekeeping tasks.
A6 Battery Volts Monitor channel
A7 Battery Temperature monitor channel
PB0 Timer 0 External clock Input T0
PB1 Timer 1 External clock Input T1
These 6 additional digital lines are taken from Port C PC2 to PC7. PC6 and PC7 form the inputs for a 32kHz crystal oscillator.
D16
D17
D18
D19
D20 32kHz crystal (RTC implementer in Timer 2)
D21 32kHz crystal.
Selection of Peripherals
WiNode 5 makes full use of the SPI bus to control the peripheral devices:
RFM69 Wireless transceiver /CS = Dig10 Int = D2
23K256 SRAM /CS =
microSD card /CS =
The MCP79410 Real Time Clock uses the I2C bus
D14 = DDA
D15 = SCL
The WiNode was originally designed to be a universal wireless sensor/controller board - made compatible with the JeeLabs RFM12 library and compatible with JeeNodes and the Open Energy Monitor range of devices. I have continued this approach - but upgraded the RFM12B to the more capable RFM69 - which shares the same footprint.
In addition I have also added a dual row socket to accept the ESP8266-01 WiFi device. This will allow this board to act as a bridge between WiFi and the RFM low power wireless ecosystem.
Applications
As stated earlier - this board has been designed to act as a controller for the experimental Open Inverter Project.
It's main function is to carry out the safe drive up to two H-bridges and monitor the currents and voltages when the inverter is operational. The inverter is sufficiently flexible to work as a buck and boost converter - allowing dc to be transformed.
The on board RFM69 (or ESP8266) allows the voltage, current and temperature readings to be conveyed to either EmonCMS, Emon-Pi or a wireless router.
The board is capable of being battery powered from a lithium or other (alkaline) cell - as it has a boost converter that works down to 0.6V.
The board may also be used as a stand alone battery powered multi-channel datalogger.
Circuit Description
This is all very standard Arduino stuff. ATmega1284 running from a 3V3 logic supply and running at 16MHz (- proven to work reliably - despite what the data sheet suggests).
In addition to the standard FTDI cable 6 pin connector for power, debugging and serial UART connection, there is the option of a USB- virtual serial port connection - provided by the CH340G - a low cost alternative to the FT232R.
The GPIO is pinned out in a way that is similar to the Arduino - but certain differences between the allocation of the peripherals to the ports, means that the '1284 is a little different to the '328. The pinout of the processor is below:
Main Peripherals:
Analogue Inputs: PA0 - PA7
SPI port: PB4, PB5, PB6, PB7
I2C port: PC0, PC1
UART0 PD0, PD1
UART1 PD2, PD3
Timer 0: PB3, PB4
Timer 1: PD4, PD5
Timer 2: PD6, PD7
Timer 3:
Physical Pinout of the ATmega1284P GPIO |
List of Allocated Signals
First the fairly standard Arduino pins - except that the Timer outputs are relocated, and there is also an extra INT2 on D8:
D0 RXD (UART 0) T3 (Timer 3 clock input)
D1 TXD (UART 0)
D2 RXD (UART 1) (ESP TX) INT0 (RFM69)
D3 TXD (UART 1) (ESP RX) INT1 (RTC)
D4 OC1B (Timer 1 Outputs)
D5 0C1A (Timer 1 Outputs)
D6 0C2B (Timer 2 Outputs)
D7 0C2A (Timer 2 Outputs)
D8 INT2
D9 OC0A (Timer 0 Outputs)
D10 SPI SS OC0B (Timer 0 Outputs)
D11 SPI MOSI
D12 SPI MISO 0C3A (Timer 3 Outputs)
D13 SPI SCK 0C3B (Timer 3 Outputs)
D14 I2C SDA ( These come from Port C and are no longer shared on analogue inputs)
D15 I2C SCL
A0
A1
A2
A3
A4
A5
These signals are in addition to those normally found on ATmega 328 Arduino. I have allocated them for general housekeeping tasks.
A6 Battery Volts Monitor channel
A7 Battery Temperature monitor channel
PB0 Timer 0 External clock Input T0
PB1 Timer 1 External clock Input T1
These 6 additional digital lines are taken from Port C PC2 to PC7. PC6 and PC7 form the inputs for a 32kHz crystal oscillator.
D16
D17
D18
D19
D20 32kHz crystal (RTC implementer in Timer 2)
D21 32kHz crystal.
Selection of Peripherals
WiNode 5 makes full use of the SPI bus to control the peripheral devices:
RFM69 Wireless transceiver /CS = Dig10 Int = D2
23K256 SRAM /CS =
microSD card /CS =
The MCP79410 Real Time Clock uses the I2C bus
D14 = DDA
D15 = SCL
Interrupt/Alarm = D3
Inverter Headers JP1 and JP2
Inverter Header JP1 uses A0 and A1 for current measurement and B0, B1 for miscellaneous control signals.
Inverter Header JP2 uses A4 and A5 for current measurement and A2, A3 for miscellaneous measurement and control signals.
ESP8266-01 WiFi Module
Uses UART 1 (D2 and D3) for communication
Inverter Headers JP1 and JP2
Inverter Header JP1 uses A0 and A1 for current measurement and B0, B1 for miscellaneous control signals.
Inverter Header JP2 uses A4 and A5 for current measurement and A2, A3 for miscellaneous measurement and control signals.
ESP8266-01 WiFi Module
Uses UART 1 (D2 and D3) for communication
Circuit Schemtic and EagleCAD files
These will be added soon - as the design is finalised
These will be added soon - as the design is finalised
No comments:
Post a Comment