MegaPi

megapi.jpg

megapitb6612.jpg megapidrv8825.jpg

This board contains an ATmega2560 and is compatible with Arduino.

It can connect directly to a Raspberry Pi or work standalone.

Power applied to the DC input jack may be between 6V and 12V and feeds up to four motor controllers and the TI regulator which outputs 5V at up to 3A for logic.

When using the DC jack, 5V is delivered to the Pi header to power the Raspberry Pi (reliability unknown).

A USB cable is used to program via the bootloader on the MegaPi.

WARNING: Various issues have been observed with the board causing any connected scope to reboot and other devices on the same power circuit behave erratically. Something to consider when powered by a random 12V PSU which may have an earth at a different potential to the earth of other devices.

Motor controllers

At least two are known to exist, the TB6612 and DRV8825.

TB5512

The TB6612 refers to two pins NE1/NE2 which are nowhere to be found on the data-sheet so no idea what they are without reverse engineering the layout. It also has its own dedicated output connector

DRV8825

The DRV8825 is a stepper motor driver and uses the pinout on the board and also utilises the regular motor outputs.

For a NEMA17 motor rated at 400mA per phase the trimmer should be adjusted to 0.2V to limit the current into the motor.

Setup

Pinout

CH340 Tx -> Rx0 PE0
CH340 Rx <- Tx0 PE1

RPi   Tx -> Rx2 PH0
RPi   Rx <- Tx2 PH1

BT    Tx -> Rx3 PJ0
BT    Rx <- Tx3 PJ1

LED PB7
Rx1 PD2
Tx1 PD3

NB Disable system login console on Pi to enable AVR UART2 comms.

Motor I/O

GPIO

       1    2    3    4
ENABLE PC2  PC1  PL7  PF5
MS1    PC3  PC0  PL6  PF4
MS2    PC4  PG1  PL2  PF3
MS3    PC5  PG0  PL1  PF2
RESET  PC6  PD7  PL0  PF1
SLEEP  PD3  PD2  PE5  PE4
STEP   PB6  PH5  PH6  PE3
DIR    PB5  PH4  PH3  PG5

TIMER

MOTOR TIMER STEP
1     OC1B  PB6
2     OC4C  PH5
3     OC2B  PH6
4     OC3A  PE3

Motor wiring

NEMA

Left to right (socket pointing upward)

This may actually be reversed or just wrong.

1 PHASE 2 START   GREEN/WHITE   B+   B2
2
3 PHASE 2 FINISH  GREEN         B-   B1
4 PHASE 1 FINISH  RED/WHITE     A-   A1
5
6 PHASE 1 START   RED           A+   A2

MOTOR

A `generic' cable from eBay (these vary)

A+ RED
A- GREEN
B- BLUE
B+ BLACK

My generic cable has the two centre pins twisted.

PORT

Left to right (from above)

B+ B- A- A+

Wiring as per above will result in correct shaft direction. Reverse wiring or swap one pair of wires to rectify incorrect direction.

Resources

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies