Jump to content
  • 0
cyclemat

Lwclone On Arduino Mega 2560

Question

Here comes the LWClone on Arduino MEGA 2560

 

How to Compile

Windows Prerequisites

On Windows, you will need a copy of the latest Atmel Toolchain, either downloaded 
and installed as a standalone package, or installed as part of Atmel Studio. 
You will need to ensure that the "bin" directory of the toolchain is available 
in your system's PATH environment variable.

In addition, you will need to install a ported version of the ZSH or BASH *nix shells, 
and a standard set of *nix utilities such as cut, find and sed. 
These can be found in the "basic" system package of the of the MinGW installer (http://www.mingw.org). 
Once installed, add the "msys\1.0\bin" of the MinGW installation folder is added 
to your system's PATH environment variable.

The bootloaders currently also require the "bc" application, 
which can be installed from http://gnuwin32.sourceforge.net/downlinks/bc.php. 
Once installed add the "GnuWin32\bin" path of the GnuWin32 installation folder 
to your system's PATH environment variable.

Linux Prerequisites

On Linux systems you will need to install the latest Linux distribution 
of the standalone Atmel Toolchain from the Atmel website for general development, 
or use the latest avr-libc and avr-gcc packages for your chosen distribution's package 
manager. For full device support, the Atmel standalone package is recommended.

How 2 Flash

Connect your Arduino to USB and look witch comport it has
Start Flash Main Chip Arduino Mega to LW.bat
enter your Comport e.g com2 or com32 what ever
Remove USB
Connect your USBASP to the ISP header behind the USB port
Start Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to LW.bat
Connect The USB port wait for reorgination the Device 
Start Change ArduLW ID.bat
Enter your LEDWIZ ID e.g. 1 or 2 up to 16
That is it test it with Visualpinball an Pinmame/DOF

 have make New packages 23.01.2016

 

https://mega.nz/#F!bdZHVaxK!3WmePgTED-3xQp8oj-ZfOA

 

one package with inverted LED ports so that High ist normal and low is on ( for the Relaisboards from ebay)

 

 

For Boards that say it gives problems with The STK500 Timeout Error Here ist a Short way to fix it !?!?

 

 

1. Connect the USBASP to the ISP connector behind the USB Port.

2.Start the  "0. Flash 8u2 - 16u2 Arduino Mega - with USBASP Dongle to Arduino.bat"

 

3. Connect the USBASP to the Second ISP port

4. Start the "Flash m2560 Unlock fuses, erase, verify - with USBASP Dongle.bat"

5. Start the "Flash m2560 Write the bootloader, set the lock fuse, verify  - with USBASP Dongle.bat"

 

 

Now you can flash it normaly

 

when the flash with the USB ASP didnt work test to bridge the GND point on the 10->6 Pole Converter

 

FOR HELP PLEASE POST YOUR PINMAP.H AS CODE AND WHEN YOU HAVE COMPILING PROBLEMS POST YOUR OUTPUT AS CODE SO I CAN BETTER

HELP

 

So have make a little Video tutorial don`t say anything about my english have do my best.

 

 

 

 

 

Share this post


Link to post
Share on other sites

207 answers to this question

Recommended Posts

  • 0
FP were in the files, I found an update of the files in another forum, are exactly the same files. I replaced the files I had the new and simply worked!
some bumpers are not triggering some relays, but that I should have to manually configure the settings of Ledwiz file, the outputs are tested and work very well.
 
On the wires, I took apart an IDE connector of an old motherboard and pulled the pins same as the photo below, I soldered the wires on pins and plugged in Arduino doors.
 
It was good.

 

conector_ide.jpg

 

 

See the photo of my parent I'm adding an H bridge to control a shaking motor. but also want to control with the same bridge a gear motor. My H board has output for two different engines and provides up to 2A per channel. Should suffice.
I bought 3 IC ULN2803 and will build a PCB driver board to connect the RGB LEDs to Lwclone doors.
 
Do you have any tips on these?
 

:D

Share this post


Link to post
Share on other sites
  • 0

Hello,

I am building a small cabinat 24" playfield and 17" backglass with little budget.

For inputs i am using the gamepad hack.

 

Now i am looking for a small solution for 5 contactors. (bumper + flipper R/L)

I will use 5 relayboards from ebay.

 

Is it possible to use a Arduino Micro?

with its ATmega32U4 it has USB interface and lots of I/O ports.

 

If not

Please help me to unerstand how the comunication works between PC, ATmega16U2 and ATmega2560.

 

Hope you can help me :)

Share this post


Link to post
Share on other sites
  • 0

Hello, first of all thank you for this fantastic project.

Sorry if my English is bad, but I'm French and I have to go through google translate.
I bought everything necessary to make the ledwiz clone and I have a problem for the programing of the m2560.
I put a photo of the mistake I attached.
For cons, the flash 8U2 via USBASP normally happens.
I tried on another PC and I have the same error.
I even change the com port manually, but still the same problem.

Anyone have a solution to my problem?
If not, is it possible to directly program the M2560 directly via USBASP (I've tried to do, but a priori, it does not work).

post-10632-0-15392300-1455200963_thumb.jpg

Share this post


Link to post
Share on other sites
  • 0

please use a USB ASP in the MEGA link you see the good and not good UAS ASP.

when you have problems with the programming please flash first the Arduino with the Firmwares on the Two chips with the firmware in the package then you didnt become a STK error. I have flash yesterday on the same way

Share this post


Link to post
Share on other sites
  • 0

@orekl you can compile it for breakout but you must compile it by your self and find the right flash options in the www you! nest is yyou use the arduino mega 2560 with 16u2 and the 2560 the 16u2 ist only the converter from UART 2 USB !

Share this post


Link to post
Share on other sites
  • 0

Sorry if i am intruding on something sacred, but why do you need to reflash the bootloader and the usb chip to use the mega2560 as a ledwiz?

It is used in most 3d printers without any need for reflashing the usb chip.

 

Have i missed something profound?

Share this post


Link to post
Share on other sites
  • 0

 

FP were in the files, I found an update of the files in another forum, are exactly the same files. I replaced the files I had the new and simply worked!
some bumpers are not triggering some relays, but that I should have to manually configure the settings of Ledwiz file, the outputs are tested and work very well.
 
On the wires, I took apart an IDE connector of an old motherboard and pulled the pins same as the photo below, I soldered the wires on pins and plugged in Arduino doors.
 
It was good.

 

conector_ide.jpg

 

 

See the photo of my parent I'm adding an H bridge to control a shaking motor. but also want to control with the same bridge a gear motor. My H board has output for two different engines and provides up to 2A per channel. Should suffice.
I bought 3 IC ULN2803 and will build a PCB driver board to connect the RGB LEDs to Lwclone doors.
 
Do you have any tips on these?
 

:D

 

 

You really don't need any ULN chips if you want to drive loads bigger than what the arduino can handle, just use a logiclevel mosfet on each output then you can drive whatever the ps and the mosfet can handle.

If you are scared of burning the arduino also use a optocoupler to galvanically separate the board from the highpower side.

Use p-channel for noninverted outs, and n-channel for inverted outs. (or as me inverters + n-channel)

I am building a board right now (no opto) (sat all day with eagle today) first time ever, and made a board i will use for myself from a real ledwiz. Already tried breadboarded.

I use a 4049 to invert the outputs and feed a n-channel mosfet. Works good.

 

Also, a h-bridge is totally meaningless, you aren't going to reverse the motor are you? And 2 amps? That is not much for a motor unless it is really small. You can't run a wiper motor on that.

You already have pwm outputs so drive the mosfets direct.

Share this post


Link to post
Share on other sites
  • 0

And i still don't understand why the usb chip has to be reflashed on the 2560.

 

And the 16u2/8u2 only exists on genuino, not china clones. China clones use another chip (atleast those i have seen and used).

Share this post


Link to post
Share on other sites
  • 0

And i still don't understand why the usb chip has to be reflashed on the 2560.

 

And the 16u2/8u2 only exists on genuino, not china clones. China clones use another chip (atleast those i have seen and used).

 

The 16U2 is also used on China Clones!

But the Chips are more expensive.

 

The very common CH340 is mostly used on the cheap ones!

But the CH340 is only a Serial communication Chip and not a microcontroller like the 16U2!

 

 

 

Update regarding to my Shields:

I have again some Shields in Stock!

Small Update on the Layout:

+5V and +3V3 is now out on a Screw Terminal

When anybody needs the Voltage.

Share this post


Link to post
Share on other sites
  • 0

Hello Arduino Wiz Folks!

 

I need some help.

 

How can I get the 2nd function from a Digital Input? (Shift function in the key mapping)

 

Example code:

_map_( H, 3,    KEY_Esc,         KEY_F3            ) /* ( OC4A )              Digital pin 6 (PWM) */ \

Here we have...

Digitial Input (arduino side): DI 6

 

Key Mapping:

1st: "ESC" key

2nd "F3" key

 

My problem is, that I don't know how to get the "F3"key funtion active.

 

The "ESC" key works fine.

 

Please, I need some help.

 

(my actual key mapping is attached)pinmap.txt

 

Thank you!

 

 

Sascha

Share this post


Link to post
Share on other sites
  • 0
 


 

searching the net for information on how to program the arduino as the LED wiz , I found this forum .

 

 

download the file from the beginning of the post ,

 

I suppose  to use this for the process: MAME 2P KIT 23.01.2016

 

I need program for use with mame and Hyperspin.

 

thanks from Spain, and and sorry for my poor English

 

 

Share this post


Link to post
Share on other sites
  • 0

Hello Arduino Wiz Folks!

I need some help.

How can I get the 2nd function from a Digital Input? (Shift function in the key mapping)

Example code:

_map_( H, 3,    KEY_Esc,         KEY_F3            ) /* ( OC4A )              Digital pin 6 (PWM) */ \
Here we have...

Digitial Input (arduino side): DI 6

Key Mapping:

1st: "ESC" key

2nd "F3" key

My problem is, that I don't know how to get the "F3"key funtion active.

The "ESC" key works fine.

Please, I need some help.

(my actual key mapping is attached)attachicon.gifpinmap.txt

Thank you!

Sascha

Solved....

Share this post


Link to post
Share on other sites
  • 0

Today I compiled the Code for an "Arduino Lenoardo" with the Atmel Mega32U4 Chip.

 

The Upload to the Chip is extremly easy!

Not so complicated as to the Mega2560!

 

Here are the Steps (#2-4 is the complicated part)

1. connect the Lenoardo to your PC

2. open the Device Manage and subfolder "Com Ports"

3. PRESS the RESET button on the Lenoardo

4. recognize the COM Port after the reset, that one is needed to upload the code

5. PRESS reset again (because after a few seconds after the Reset, goes the Bootloder from "Bootloader MODE" back to the normal "Leonardo Mode")

6. shortly after the reset start your HEX Code upload with the AVRDude (or use my batch file)

7. be happy! ALL DONE!

 

NO USB ASP needed.

Maybe you need 2 or more Leonardos to get enough I/Os

 

When we find some people (3 or more), then I can Design a Breakoutboard, like for the Mega2560. 1x for only LEDs, shakers, Motors and 1x for Keyboard inputs and some LEDs.

 

PinMap for LED only:

arduino_leonardo-pinmap - LED.pdf

 

PinMap for Keyboard and LED (example, possible to change it to your needs):

arduino_leonardo-pinmap - Keyboard.pdf

 

here a Video with a small Test (LED only):

Share this post


Link to post
Share on other sites
  • 0

 

 
What is the testing program led you use in video
 
 
 
One more thing , when I connect the arduino to USB LEDs are on by default, is normal

 

 

I just use the PinballX (FrontEnd) LED Plugin.

And run the Test Function in the PlugIn Settings.

Share this post


Link to post
Share on other sites
  • 0

go to your PinballX root Folder.
Start the "PluginManager.exe"

 

follow my screenshot:

- activate and select the "LED Plugin"

- click an "Configure"

post-9192-0-34162300-1461765339_thumb.png

 

on the next window:

- made you pattern or just use the sample

- click on "Test" and the pattern starts and your LEDs are Light UP!

post-9192-0-74903700-1461765338_thumb.png

 

To connect the LEDs:

USE ONLY low current standard LEDs! Never connect HIGH current FLASHER, 3W RGB LEDs or something else with HIGH current directly to the Arduino!!!!!!

Arduino Output -> LED Anode (+) -> LED Cathode (-) -> current limiting resisor (470 Ohm is good for 5V Test with Arduino) -> GND

 

Small Help for LED  polarity:

https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity

 

 

- Sascha

Share this post


Link to post
Share on other sites
  • 0

Hello,

 

I used the Pin-Package to flash my LEDWiz Clone.

1st I flashed the Mega2560 via *.bat file and the 16U2 via Flip.

2nd time I flashed it via STK500 Board and with the fix.

 

But unfortunately the joystick inputs don't work and the analogue Inputs are having some weird behavior: Y-Axis ist working fine. X-, Z- and rX-Axis are behaving same way to another. rY- and rZ-Axis are dead at 50%.

 

Don't know how to fix this. Any suggestions?

 

I would be really glad for your help!

 

 

Greetings, 

BlackZero

Share this post


Link to post
Share on other sites
  • 0

@Javier15 you need a 10 to 6 converter and bridge all GND point on the converter

second is its not normal that all leds on on power on its only so when you use the invert function that i have activate in my invert pin pack

 

Share this post


Link to post
Share on other sites
  • 0
  • 0
1 hour ago, cyclemat said:

@Javier15 you need a 10 to 6 converter and bridge all GND point on the converter

second is its not normal that all leds on on power on its only so when you use the invert function that i have activate in my invert pin pack

 

 

 

Hello cyclemat,
I think I already answered that question more than one year ago jajajaj thanks anyway
I now take this opportunity to make an inquiry ..
How do I turn off the accelerometer? I have a plate kl25z with which use the plunger and the nudge.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×