Jump to content
  • 0

Lwclone On Arduino Mega 2560


cyclemat

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.

 

 

 

 

 

Link to comment
Share on other sites

222 answers to this question

Recommended Posts

  • 0
Well, I would like to thank everyone for the help!

Especially Cyclemat, I can call VPinGOD !!

 

Yesterday I managed to do my LWclone work seamlessly with FP.

 

Today I started building my control board, thank you !!

 

 

 

May the force be with you!

Link to comment
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

Link to comment
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 :)

Link to comment
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

Link to comment
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

Link to comment
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?

Link to comment
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.

Link to comment
Share on other sites

  • 0
  • Content Provider

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.

Link to comment
Share on other sites

  • 0
  • Content Provider

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

Link to comment
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

 

 

Link to comment
Share on other sites

  • 0
  • Content Provider

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....

Link to comment
Share on other sites

  • 0
  • Content Provider

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):

Link to comment
Share on other sites

  • 0
  • Content Provider

 

 
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.

Link to comment
Share on other sites

  • 0
  • Content Provider

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

Link to comment
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

Link to comment
Share on other sites

  • 0

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
×
  • Create New...