Arduino & EB081 Shield

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Arduino & EB081 Shield

Post by JohnCrow »

Introduction To using Arduino Microcontrollers With E-Blocks & Flowcode

Introduction:

Arduino’s are microcontroller development boards that use AVR processors.
Several different versions are available using a range of devices.
The strange names held by some of them is due to the fact they are of Italian design.
The boards and are open source, and clones are also available.

They have a row of sockets around the edge giving access to the pins on the processor.

Whereas Matrix hardware is connected using the 9 pin D plugs, the Arduino uses a system called shields.

These have pins underneath to plug into the Arduino, and sockets on the top that mirror the ones on the main board. This allows different shields to be stacked.
Shields, however cannot be used with the Matrix E-Block adaptor.

This article will be based on my initial experience with the Arduino Mega 2560.
Different versions of the Arduino may have different Port / Pin allocations, so it will be necessary to check the data sheets.
Arduino 2560 Mega
Arduino 2560 Mega
Photo1.jpg (146.43 KiB) Viewed 5834 times
Basic Specifications:

Processor Atmel ATmega 2560
Clock 16MHz Crystal
Power Socket 7V to 12V DC Center Positive
Flash Memory 256kB (8kB used by Boot- loader)
SRAM 8kB
EEPROM 4kB
DC Current /Pin 40mA

Programming:
The device can be programmed by either the USB using a Boot-loader, or by the 6pin header using an AVRISP programmer.(Between the processor and the reset push button).

Connections:
54 Digital I/O Lines (Including PWM & I2C)
16 Analogue Inputs

Full specifications can be downloaded from the Arduino Website
http://www.arduino.cc

Interconnection:

The Arduino has SIL headers to allow connection to all the ports.
(Or as pointed out above to allow the connection of shields to the board)

This is done by means of single core copper wire (approx 22-24 gauge)
Personally I would recommend using flexible turned pin jumper cables.
These are much less likely to break off in the sockets, which is very difficult to remove.
These can be obtained in various lengths, from most component suppliers, including Matrix Multimedia.

Matrix E-Block Shield:

Matrix Multimedia produces a shield board for the Arduino.
Part Number EB081

Warning:
Ensure both power and programming / USB cables are disconnected from both boards when attempting to mount/dismount the Arduino.
To avoid damage ensure the pins are all aligned correctly and only use gentle pressure to push the boards together.

EB081 - Arduino Mega2560
EB081 - Arduino Mega2560
Photo2.jpg (104.31 KiB) Viewed 5834 times
This is a small pcb with 5 D-Type connectors to allow standard E-Blocks to be connected to the Arduino.
The Arduino is simply pushed onto the SIL headers on the shield board, this then brings all the connections out. The AVRISP is also broken out onto the board.

An exception to this is with the 2560 Mega board, where the double row of digital connections is not accessible when on the shield.

The connections are arranged as follows

Analogue Ports

J1 (A0-A7)
These are the analogue ports ADC0 – ADC7.
In Flowcode they are referenced by the port connections on the actual microcontroller device
PF0 – PF7

J4 (A8-A15)
These are the analogue ports ADC8 – ADC15.
In Flowcode they are referenced by the port connections on the actual microcontroller device
PK0 – PK7

Pin 9 on all the D-Types is connected to ground.

Digital Ports

The other 3 connections are the digital ports. These are slightly more fiddly to use in Flowcode as they are spread across more than one port on the microcontroller.
This will not normally cause a problem as the lines can be individually configured in the component properties.

J2 (D0-D7)

D0 PE0
D1 PE1
D2 PE4
D3 PE5
D4 PG5
D5 PE3
D6 PH3
D7 PH4

J3 (D8-D13)

D8 PH5
D9 PH6
D10 PB4
D11 PB5
D12 PB6
D13 PB7

J5 (D14-D21)

D14 PJ1
D15 PJ0
D16 PH1
D17 PH0
D18 PD3
D19 PD2
D20 PD1
D21 PD0

Pin 9 on all the D-Types is connected to ground.

The board breaks out the 5V and 3.3V connections from the Arduino, this allows both E-Blocks and other items such as sensors that need 3.3V to be powered.
It also allows a different Analogue VREF voltage to be connected to the Arduino.

I have generated a spreadsheet to show the mapping for the ports for the Arduino Mega 2560 & the UNO R3 (PDIP)
Arduino E-Blocks Shield Ports.zip
Port Mapping Spreadsheets
(15.57 KiB) Downloaded 409 times
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Arduino & EB081 Shield Part 2

Post by JohnCrow »

Test Programs:

These are some very simple test programs.

They are aimed at testing the operation of both the Arduino and the E-Block, and not teaching Flowcode programming.

The easiest way to program the Arduino with Flowcode is to use the AVR ISP programmer.
This connects to the 6 pin header on the EB081.
Take care to align the red cable with pin 1 on the pcb.
These can be obtained from Matrix Multimedia as either a separate device or as part of the AVR programmer kit.

http://www.matrixmultimedia.com/product ... PHPSESSID=

http://www.matrixmultimedia.com/product ... PHPSESSID=

This method also needs a power supply connected to the co-ax socket on the Arduino.

Power must be 7V – 12V DC (centre positive)
Note unlike the Matrix programmers the Arduino is not polarity tolerant.
AVR Programmer
AVR Programmer
Photo3.jpg (194.56 KiB) Viewed 5833 times
Note.
Using the AVR programmer will erase the Boot-loader from the Arduino.
This has to be reloaded by means of the standard Arduino IDE program..

It is possible to program the Arduino using the USB cable in Flowcode.
See the following article on the Matrix forums.

http://www.matrixmultimedia.com/mmforum ... 46&t=10944

A0-A7 Binary
A simple binary counter on port A0-A7. Just counts from 0 to 255 (Binary) in a continuous loop.
Sends the value to Port F, with a 20ms delay between values.


A8-A15 Binary
A simple binary counter on port A8-A15. Just counts from 0 to 255 (Binary) in a continuous loop.
Sends the value to Port K, with a 20ms delay between values.



D1-D7 – LED
Turns on each led in sequence by setting the bit high.
A 100ms delay is the added before turning on the next bit
The lines are as follows
PE0 PE1 PE4 PE5 PG5 PE3 PH3 PH4
After turning on the last bit, a further 100ms delay is added before turning off all ports and restarting.

D8-D13 LCD
A simple “Hello World” application
Displays a simple message on the E-Block display.
The 5V Supply for the LCD-E-Block can be taken from the 5V screw terminal on the shield.

This port only has 6 lines, so all can be tested by using the LCD.

D14 – D21 LED
Turns on each led in sequence by setting the bit high.
A 100ms delay is the added before turning on the next bit
The lines are as follows
PJ1 PJ0 PH1 PH0 PD3 PD2 PD1 PD0
After turning on the last bit, a further 100ms delay is added before turning off all ports and restarting.
Arduino Test Programs.zip
Test Programs
(15.86 KiB) Downloaded 408 times
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Arduino & EB081 Shield Part 3

Post by JohnCrow »

PART 3

Arduino Programming Environment

This section will cover a brief introduction to the default Arduino IDE.
Both Arduino hardware and the software are open source.
The default language is very similar to C.
In Arduino language the programs are called sketches.

Library files are used. These are called in a similar way to header files in C. These are stored in the library sub folder in the Arduino IDE.
Arduino IDE
Arduino IDE
Photo4.jpg (91.46 KiB) Viewed 5832 times

The library LiquidCrystal.h contains the configuration to use a LCD display.
The data is sent in the following order

RS, E, D4,D5,D6,D7 which map to pins Digital Pins 4,5,0,1,2,3


Above is a screen shot of the IDE with a simple sketch loaded.

The program prints “Hello World” on the top line of the LCD and on the lower line counts up in seconds.
Program Running
Program Running
Photo5.jpg (85.39 KiB) Viewed 5832 times
The Arduino is connected to the PC via the USB cable.

Using this method allows the Arduino to send data back to the PC which can be displayed in a serial monitor window.
1 in 10 people understand binary, the other one doesn't !

Post Reply