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

Recommended Posts

  • 0
  • Content Provider
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.

Link to comment
Share on other sites

  • 0

Hi..i am a new user here. I downloaded the first Version from earlier today and managed to get it on my ardu and it seems to work fine.So now i downloaded the new Version and try it later or is there no diff between the hex files and only an install bat + arduino soft added ?Another question is are you planning to release the source so that we can create the hex ourself´s and have the possibility to change the ID and the Portmapping ?

surface mount pcb assembly

Link to comment
Share on other sites

  • 0

To enable or disable any functions you must edit the folow files

in Devconfig.h

#ifndef DEVCONFIG_H__INCLUDED
#define DEVCONFIG_H__INCLUDED


/****************************************
 USB device config
****************************************/

#define ENABLE_LED_DEVICE       <- Enable the LED LEDWIZ Outputs
#define ENABLE_ANALOG_INPUT     <- Enable Normal Joystick Analog inputs
#define USE_ACCELGYRO 1         <- Esnable Gyro Controller ( Sixaxis Device )
#define ENABLE_PANEL_DEVICE     
#define NUM_JOYSTICKS 0         <- Number of Normal Joys 2Axis and 12 Buttons
#define USE_MOUSE 1             <- Enable Mouse Controlls
#define USE_CONSUMER 1          <- Enable Multimedia Keys
#define USE_KEYBOARD 1          <- Enable Normal Keyboard device



#endif

 

Link to comment
Share on other sites

  • 0

I'm trying to follow your YouTube tutorial and I have a doubt.

At time 15; 20 on your video, you open 'simple LED test' application, but i do not find that application. Where do i find it?

On the other hand, i have flashed LedWiz Clone to my arduino in my laptod, But I want to install vpinball in other PC.

Do I need to change ID in the second PC or can I change it in my laptop?

Link to comment
Share on other sites

  • 0
On 6/12/2016 at 11:46 AM, jacaba said:

I'm trying to follow your YouTube tutorial and I have a doubt.

At time 15; 20 on your video, you open 'simple LED test' application, but i do not find that application. Where do i find it?

On the other hand, i have flashed LedWiz Clone to my arduino in my laptod, But I want to install vpinball in other PC.

Do I need to change ID in the second PC or can I change it in my laptop?

I can find "Simple LED Test" and i work my ledwiz clone.

all digital outputs work just fine, but i want to use  Analog support and the analog Acelometers. 

how my english is very bad I have trouble following and I don´t know if It has managed to make both things work.

 

My idea is use this potenciometer for plungler. 

https://es.aliexpress.com/store/product/Free-shipping-Electronic-building-blocks-slide-potentiometer-module/433698_2029224818.html?detailNewVersion=&categoryId=400199

 

and this acelometer for tilt.

https://es.aliexpress.com/item/GY-61-ADXL335-Module-3-axis-Analog-Output-Accelerometer-angular-transducer-3v-5v-Wholesale-Electronic/32463825736.html?spm=2114.13010608.0.0.ZSOUUK

 

Could you say me if can both work? 

i need help for get this. 

thx for help 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

  • 0
  • Content Provider

I have a problem with my clone and I think it should be very easy to solve .. apart from the Ledwizclon I have a Pinscape plate that works great as a joystick and for the nudges but when I install the ledwiz clone this appears as joystick 1 and the pinscape Like joystick 2 and there is my problem.

My query is .. how do I disable the clone joystick? This is my Devconfig.h file maybe I'm getting something wrong here.

 

 

 

/*
 * LWCloneU2
 * Copyright (C) 2013 Andreas Dittrich <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef DEVCONFIG_H__INCLUDED
#define DEVCONFIG_H__INCLUDED


/****************************************
 USB device config
****************************************/

#define ENABLE_LED_DEVICE

#define ENABLE_PANEL_DEVICE
#define NUM_JOYSTICKS 0
#define USE_MOUSE 0
#define USE_CONSUMER 0
#define USE_KEYBOARD 0

#endif

Link to comment
Share on other sites

  • 0

Hi Cyclemat,

First of all,  Thx for your "How To" and all the works  you've done to simplify the flash of the Arduino.

I want to inform you that I translated and adaptated your tutorial in french and I posted it in the forum Pincabpassion.net : http://www.pincabpassion.net/t5411-tuto-transformer-un-clone-d-arduino-mega-2560-en-clone-de-ledwiz#113812,

 Could you give me your blessing for this share ? (lol)

If you don't, i will erase my topic.

 

Best Regards

Link to comment
Share on other sites

  • 0

Hi cyclemat,

first of all many thanks for that awesome work. you've done !

I am using an arduino Mega2560 R3 board and flashing just works fine with avrdude and the atmels switch application .. no need for USBasp ...

Currently I am only using the board to connect accelerometer ADXL335 and plunger poti, which works fine up to now ... more to come ... 

I have build lwclone from this git repo https://github.com/cithraidt/lwcloneu2

I just wonder whether the sources are the latest version as the last commit in the repo is form 2014 and I have seen that you have distributed the last binary package here 2 years later.

Best Regards

step

 

Link to comment
Share on other sites

  • 0

Hello, 

I'm having some doubts about how to use the accelerometer in LWclone, just plug the x, y, z into which LWclone ports of the Mega 2560 Arduino?

In the pinout that I have annotated for LWclone tells me that on the analog ports of a1 through a6, x-1, x-2, y-1, y-2, z-1, z-2. I was a little lost with that, in which arduino pin should I connect the X, Y and Z of the accelerometer sensor?

Another question, in my CAB I have a shake engine, can the vibration affect the reading of the accelerometer and does it understand that we are giving TILT?

Thank you very much!

Link to comment
Share on other sites

  • 0

Hi cyclemat you are my vp hero (together with unclesash)..... keep up your very good work! thank you for all!

I have some questions about the ledwizclone:

1) In your video there is a verify error after checking the written default bootloader. I got this error too. Is this O.K.? Just a china R3 clone problem?

2) How can we use the ADXL335? All tables in VP are unplayable if analog nudge is activ. What is the right VP setting for ADXL335??

3) Under Win10 i got the ledwizclone recognized with additional 2 or 4 Hid Usb devices (Gamecontroller) at the same time?  Its inpossible to delete this devices with USBDeview. Just a ID change will help for some time but the problem will appear again if USB cable is disconnected or reboot. Is this a firmware, driver or hardware (power) problem? I have 12V connected via the unclesash shield. Is there a special driver needed?

4) Can you show how to connect the z-diode with ULN2803 to get different voltages to a single port and not the whole bank. And how to connect the H-Bridge? Have you made a direct connection to the ULN chip or a firmware with one inverted port? The H-bridge needs a positv input.

Link to comment
Share on other sites

  • 0
  • Content Provider
Thx for this great job[mention=15084]kakou[/mention], I hope your work will get the highlights it deserves;

Bye bye ADXL335 [emoji14]

NOTA : i've just informed[mention=9192]UncleSash[/mention] on his FB account. I hope he could create a new shield with this new chip integration

 

Yes , I go on and create a new shield, that includes the new nudge sensor.

Take a bit time, but it is coming.

 

Thank you [mention=13891]Aetios[/mention] for your great job!

Link to comment
Share on other sites

  • 0

If there are people having problems to make a working setup for flashing or compiling maybe this helps.

Flashing:
Different method, little bit more work and an usbasp is needed. But with easy visual interfaces and no need for the bat files or to set fuses first.

Need:
-USBASP with connector for 6p ICSP
-arduino_mega2560__m16u2.hex file
-arduino_mega2560__m2560.hex file
-Zadig; Software to install libusb-win32 driver for USBASP
-eXtreme Burner - AVR; Programmer software with GUI (free but registered download)

Steps:
-Connect usbasp
-Install/config Zadig + eXtremeburner.
-Open eXtreme Burner.  
-Choose the right hex file and chiptype
-Click "write all" to flash (this also sets the fuses)
-Do this for both chips on the mega.
-Done.


Backup; Maybe save reading from chips as a hex file first.

Restore Arduino bootloader; Do the same steps but with the original hex files

 

Compiling your own pinmap:
Didn't want to mess to much with my Windows System. so I used a linux virtualmachine for compiling

Need:
-Virtualbox installed and working
-Linux VirtualBox image (a ready to go lubuntu image can be downloaded from http://www.osboxes.org

Steps:
-Start the linux virtual machine and open a terminal in it
-Type the following (Press enter after each sentence, when promped type password):

sudo apt update
sudo apt upgrade
sudo apt install aptitude
sudo apt install git
sudo aptitude install avrdude avrdude-doc binutils-avr avr-libc gcc-avr
git clone https://github.com/cithraidt/lwcloneu2.git

-in terminal go to the lwcloneu2 folder and type:

git submodule update --init

-make the adjustments to pinmap.h (and devconfig.h) in ..\firmware\arduino_mega2560\.. folders
-in terminal go to the lwcloneu2 folder and type:

make

-If no compile errors The flashable hex files are now ready.

 

Also have a question:

How does the shift keyfunction work? Does it have a designated key or can one assign a key of choise? Also what does the number 13 in "#define SHIFT_SWITCH_INDEX   13" do?

Link to comment
Share on other sites

  • 0

@UncleSash: Thx Dude, but that's @kakou  who made all the work ;), I've just kept informed the community about his work. 

@kakou : For those who wants to command a shield now on our forum, I will wire the new chip. I have two new commands on the way, I'm just waiting for the chip from China (that's a bit long).  I don't think we need another adapter to put the chip on the actual shield, it will be expensive and there is only two wires to glue on the shield to connect on the correct pins. ;) I will make one and share here  !

@ZZLLabnip : effectively, I tried multiple times to compile under windows system... but that didn't work, so I tried in Linux too, as you did, and it worked at second try ;) To answer at your question, The hulber 13 is the PIN of the Arduino  which is assigned to a button. This button could have another function, in my pincab, it's the coin door switch (who detects the opening of the coin door) ;)

Otherwise, if you want to use the new firmware  with the GY-45 (with MMA8451 chip, the same as KL25Z), you have to change the GitHub Adress and use the @kakou's forked version  :

"git clone https://github.com/kakou-fr/lwcloneu2"

Link to comment
Share on other sites

  • 0

@UncleSash @aetios : we have also provide a clone of the teensy that use a wemos mini pro board and manage the RGB adressable LED

It would be fun if we can have one single shield for the mega 2560, MMA8451, and the wemos :) 

Link to comment
Share on other sites

  • 0
35 minutes ago, kakou said:

@UncleSash @aetios : we have also provide a clone of the teensy that use a wemos mini pro board and manage the RGB adressable LED

It would be fun if we can have one single shield for the mega 2560, MMA8451, and the wemos :) 

:wub:

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