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

you must Compile the the files to become HEX files that you can flash

 

look in the oackage there is an readme

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.


When all done go to the Folder for you arduino like Arduino 2560 it looks so

Open cmd as Admin

go to the Folder where you have extract the zip File here on C:\

cd "c:\lwcloneu2-master\firmware\arduino_mega2560\"

make all

now the files will compiled
Link to comment
Share on other sites

  • 0

I have a problem.  I downlaoded the package and used the files in it.  I did exactly this

 

programm the the 16u2 with the Arduino firmware

 

Flash the mainchip via USB

 

flash the 16u2 with the USB asp

 

the problem is
 

- Joystick axes don´t work at all

- Joystick buttons work partly (only button 1,2,3 work; rest is dead)

 

any ideas?  I have not changed anything in the package.

Link to comment
Share on other sites

  • 0
good,

  I bought and arrived here at home, 1 USBasp recorder and 3 Arduino MEGA 2560 units.

 

Can direct me to a link with a step by step how to create the flashing LWclone?

 

I need help with this because I am very bad with programming in general.

 

thank you.

Link to comment
Share on other sites

  • 0
  • Content Provider

 

good,
  I bought and arrived here at home, 1 USBasp recorder and 3 Arduino MEGA 2560 units.
 
Can direct me to a link with a step by step how to create the flashing LWclone?
 
I need help with this because I am very bad with programming in general.
 
thank you.

 

 

 

Hey buddy...

 

I work on a nice BreakOut Board for the Mega2560...

May be you are interested in it, when it works.

Rigth now I have to wait for the PCB´s (10pcs in total).

In my first try, was an issue in the layout, so I had to do it again.

 

There are all ready a lot of nice things on the board:

28x Digital Input (keyboard inputs) screw terminals

24x Digital Outputs screw terminals driven with the

3x ULN2803 (Darlington Driver IC, to run more as a few milli amps, LedWiz use the same IC!)

8x IRFZ34N MOS-FET´s for High current output (example: to run a shaker motor with up to 30 Amps, all can be run a different voltage)

1x slot for ADXL335 3-Axis Analog Accelerometer (tilt functions)

3x Axis Input (Joystick, Plunger, etc) screw terminals

 

 

I can send you a picture from the first Layout when you want to.

Just send me a Private Message.

 

best regards

Sascha

Link to comment
Share on other sites

  • 0
  • Content Provider

hello folks...

 

here is Sascha - I worked on a shield for the led wiz clone.

The pcb is now done.

Just the real life test is missing (but no vpin at the moment).

When someone likes it, just send me a Private Message.

There are over 8 PCBs left (for really less money - but without components!)

 

Updates from the tests are coming soon.

 

but here is a 1st picture:

rev 1.1 front view with parts

 
more in the Gallery:

 

regards

Sascha

Link to comment
Share on other sites

  • 0
  • Content Provider

1st Test with LED Blinky was great!

I used a Fan and some LED´s as Test (I still have no VPin at the moment!)

 

2nd Test with DOF runs good.

all 32 Outputs are working fine!

 

Pictures are coming in the next days.

I have to fight with my VirtualPinball B2SServer config and so on.

 

But the Hardware runs great!

Link to comment
Share on other sites

  • 0
Hello, excuse my lack of information .... I'm really trying to do my LWclone work in my cab.

I bought an Arduino Mega 2560 R3 and USBasp v2.0, used the .bat file to the main flasher chip. When I did this I had a mistake with FUSE but it looks like it worked perfectly, because then he asked me flasher the second chip with the file "16u2.hex".

I did not need to use the USBasp, I believe that my Arduino is genuine, what I did was connect the Arduino into DFU mode and recorded the file "... 16u2.hex" successfully using the FLIP software.

I'm believing that worked because along with LWclone2 configuration files came a file to change the LWclone ID, this file is recognizing my Arduino as a LEDWIZ ID 4, and I can perfectly modify any other ID from ID-1 and ID-16.

The program LEDblink my Arduino is also recognized as ledwiz ID-4.

Now I need to test the hardware to see if I really managed to create the LWclone in my Arduino Mega 2560.

That is where my biggest questions:

I use the Future Pinball and BAM, I add LWclone to be able to control the flasher LEDs and conctators and engine shaking, but still could not understand what pinnout the Arduino x ledwiz, ie which Arduino pin refers to which output of ledwiz.

I know I have to create a power driver to control contactors and motor, initially will make using shield relays, then I will use drive with Mosfets, but so I can continue I need to understand how to send command to the LWclone and which Arduino is output if the actual outputs of ledwiz.

I'm seeing the lists of pinmap.h who are here on the forum, do not understand how I edit and I upload to the Arduino.

Can you help me?

I'm really lost it, there is not much information about the lwclone, that there'm trying to understand.

Link to comment
Share on other sites

  • 0
  • Content Provider

Hello Thats easy.

You find that also in the PinMap.h

 

Outputs:

D22 Arduino = Output 1

D23 Arduino = Output 2

D24 Arduino = Output 3

D25 Arduino = Output 4

D26 Arduino = Output 5

D27 Arduino = Output 6

D28 Arduino = Output 7

D29 Arduino = Output 8

D30 Arduino = Output 9

D31 Arduino = Output 10

D32 Arduino = Output 11

D33 Arduino = Output 12

D34 Arduino = Output 13

D35 Arduino = Output 14

D36 Arduino = Output 15

D37 Arduino = Output 16

D38 Arduino = Output 17

D39 Arduino = Output 18

D40 Arduino = Output 19

D41 Arduino = Output 20

D42 Arduino = Output 21

D43 Arduino = Output 22

D44 Arduino = Output 23

D45 Arduino = Output 24

D46 Arduino = Output 25

D47 Arduino = Output 26

D48 Arduino = Output 27

D49 Arduino = Output 28

D50 Arduino = Output 29

D51 Arduino = Output 30

D52 Arduino = Output 31

D53 Arduino = Output 32

 

Inputs:

D2 = MOD_LeftShift
D3 = MOD_RightShift
D4 = MOD_LeftControl
D5 = MOD_RightControl
D6 = keyboard _Esc
D7 = keyboard _Enter
D8 (PWM) = keyboard _1, keyboard _P
D9 (PWM) = keyboard _5, keyboard _5
D10 (PWM) = keyboard _A, keyboard _A
D11 (PWM) = keyboard _S, keyboard _S
D12 (PWM) = keyboard _D, keyboard _D
D13 (PWM) = Josytick 1 _Up, keyboard _UpArrow
D14 (TX3) = Josytick 1 _Left, keyboard _LeftArrow
D15 (RX3) =
D16 (TX2) = Josytick 2_Button5, 0  
D17 (RX2) = Josytick 2_Button4, 0  
D20 (SDA) = Josytick 2_Button3, KM_ALT_F4    
D21 (SCL) = Josytick 2_Button2, KM_SHIFT_F7  
A0 = X - 1
A1 = Y - 1
A2 = Z - 1
A3 = X - 2
A4 = Y - 2
A5 = Z - 2
A6 = Josytick 2_Button1, keyboard _F7
A7 = Josytick 2_Right, AC_VolumeUp
A8 = Josytick 2_Left, AC_VolumeDown
A9 = Josytick 2_Up, keyboard _PageUp
A10 = Josytick 2_Down, keyboard _PageDown
A11 = Josytick 1 _Down, keyboard _DownArrow
A12 = keyboard _2, AC_Mute
A13 = Josytick 1 _Button8
A14 = Josytick 1 _Button7
A15 = Josytick 1 _Button6
 

Link to comment
Share on other sites

  • 0
Uncleash,

thank you so much!

I now have the clone pinout!

 

electronically:

the outputs are level 0v or 5v?

to trigger a relay for example, need to connect the 0v directly in the relay and the + 5V output is in the LW or just the opposite?

 

For the Arduino outputs are level 1, + 5v, if I use a shield relays to trigger a contactor I would have to connect the output of LW in the relay shield plate in the same way that I would connect it were with the Arduino?

As for controls (keyboard), are among the entries "D2 ~ D21" ....

they function as keyboard it?

 

the future pinball will recognize the commands of controls related to LW entries?

like me I trigger each entry of these between D2 and D21, which signal will connect these doors, + 5v?

 

I understand everything you're telling me, I have many doubts but now I have much more confident in what I do this for my system to work.

 

Thank you again,

May the force be with you!

Link to comment
Share on other sites

  • 0
  • Content Provider

be carefull with direct contacts.

The Arduino Outputs are not able for a lot mA.

Maybe 1 small relay.

 

LogivLevel is 0V LOW / 5V HIGH.

 

Use the ULN2803 to drive the Outputs.

Just google the Datasheet.

The ULN can run up to 500mA / each channel.

Link to comment
Share on other sites

  • 0
still have not found information on connecting the keyboard in LWclone to keyboard input in LWclone, I need to use 0v on each keyboard input for control?

 


I'm asking this because I read somewhere that the LWclone works as a keyboard controller, or it only controls the keyboard LEDs?

I see people using the LEDWIZ to control keyboard LEDs and a IPAC64 board to control the keyboard commands, but needs it?

I had understood that the LWclone control commands too .... I'm confused ...

Link to comment
Share on other sites

  • 0

So i have buy new  Arduinos and habe the same Problems. You need a USB ASP please look thar you have the Fishl Design buy no on ebay with no driver needed they didnt work.

 

 

 

The Problems are the China Bootloader 

 

so you need flash the 2560 bootloader and 16u2 bootloader 

 

 

 

this evening i will make a new video

 

have make New packages 

 

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

 

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

 

 

Shorty way of fix a Arduino

 

 

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

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