Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 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

Recommended Posts

  • 0

Hello,

Very good job.
I have a joystick to control the flips and plunger, and with the arduino the reaction time is longer. Otherwise replace a LedWIZ it works perfectly.
Are there a way to use the analog input to a motion detector and an analog plunger?
I bought this motion detector that provides different voltages depending on the inclination.

http://www.aliexpress.com/item/MMA7361-MMA7260-Accelerometer-Sensor-Module-3-Axis-low-cost-micro-capacitive-For-Arduino-Free-Shipping-Wholesale/575448645.html

Share this post


Link to post
Share on other sites
  • 0

Hello cyclemat !


Congratulation for the job.


Please I need some help to put my LWclone to work..


I write the all firmware to mega2560, when test app is runing the arduino led(13) is on and ID:4 is showed.


I Put these files into Hyperpin directory:

FPLaunch.exe

HPLedControl.exe

HPLedControl.ini

And these files into VP Tables directory:

core.vbs

ledcontrol.ini

ledcontrol.vbs

ledwizm05.ocx

 

But I get an error on VisualPinball open.


I try to Regsvr32  to file ledwizm05.ocx and get an error.


The path for the file is correct: Regsvr32 C:\Games\Visual Pinball\Tables\ledwizm05.ocx.


On devices appear: LWCloneU2 v1.0


ps. Windows 7 64bits.


 


Thanks,


Maurilio.


Share this post


Link to post
Share on other sites
  • 0

 

Hello cyclemat !

Congratulation for the job.

Please I need some help to put my LWclone to work..

I write the all firmware to mega2560, when test app is runing the arduino led(13) is on and ID:4 is showed.

I Put these files into Hyperpin directory:
FPLaunch.exe
HPLedControl.exe
HPLedControl.ini
And these files into VP Tables directory:
core.vbs
ledcontrol.ini
ledcontrol.vbs
ledwizm05.ocx
 

But I get an error on VisualPinball open.

I try to Regsvr32  to file ledwizm05.ocx and get an error.

The path for the file is correct: Regsvr32 C:\Games\Visual Pinball\Tables\ledwizm05.ocx.

On devices appear: LWCloneU2 v1.0

ps. Windows 7 64bits.

 

Thanks,

Maurilio.

 

mmmh

 

Sorry iam bussy the last months but i dont let questions Open

 

Regsvr32 "C:\Games\Visual Pinball\Tables\ledwizm05.ocx"

 

When Spaces in the Path you must use "" to say its a Complete Command

 

that is it and Please USE DOF R2 and PinballX

Share this post


Link to post
Share on other sites
  • 0

Thx for starting this Great Project!

I want to add a accelerometer like Axioma, but i am confused where the analog outputs of the accelerometer had to be connected.

Do i have to make changes in the sourcecode? - if yes, please give me a hint where to look for ;)

Also, which software should i use to configure/Control the Ledwiz itselve.

 

Any Input would be appreciated.

Will donate some bucks in about a minute.

Share this post


Link to post
Share on other sites
  • 0

Going to sort things out:

 

Modified devconfig.h:

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

#define ENABLE_LED_DEVICE
#define ENABLE_ANALOG_INPUT
#define ENABLE_PANEL_DEVICE
#define NUM_JOYSTICKS 3
#define USE_MOUSE 0
#define USE_CONSUMER 1
#define USE_KEYBOARD 1



#endif

Modified pinmap.h:

	_map_( K, 2,    J2_Down,         KEY_PageDown      ) /* ( ADC10/PCINT18 )     Analog pin 10 */ \
	_map_( K, 3,    J1_Down,         KEY_DownArrow     ) /* ( ADC11/PCINT19 )     Analog pin 11 */ \
	_map_( K, 4,    KEY_2,           AC_Mute           ) /* ( ADC12/PCINT20 )     Analog pin 12 */ \
	// _map_( K, 5,    J1_Button8,      0                 ) /* ( ADC13/PCINT21 )     Analog pin 13 */ \
	// _map_( K, 6,    J1_Button7,      0                 ) /* ( ADC14/PCINT22 )     Analog pin 14 */ \
	// _map_( K, 7,    J1_Button6,      0                 ) /* ( ADC15/PCINT23 )     Analog pin 15 */ \
	\
	/* end */

	// (port, pin, mux, value_min, value_max, joyid, axis
#define ADC_MAPPING_TABLE(_map_) \
	\
	_map_( K, 5, 0x05, 0.000, 1.000, ID_Joystick3, 0 ) /* Analog Pin 13 */ \
	_map_( K, 6, 0x06, 1.000, 0.000, ID_Joystick3, 1 ) /* Analog Pin 14 */ \
	//_map_( K, 7, 0x07, 0.100, 0.500, ID_Joystick3, 2 ) /* Analog Pin 15 */ \
	\
	/* end */

So, is that the correct way?

 

Also i do not understand the syntax of mapping Joysticks:

_map_( K, 5, 0x05, 0.000, 1.000, ID_Joystick3, 0 )

 

F,4, 0x04 is the port of Arduino - correct?

0.000, 1.000 -??

ID_Joystick3.0  is Joystick3, Axis0 - correct?

 

so, could i use ID_Joystick3.2 as Axis3 (Z-Axis of Accelrometer) too

 

Thank You for your patience!

Rainer

Share this post


Link to post
Share on other sites
  • 0

Short update:

I tried a build with the config posted above, but it fails.

After altering devconfig.h it builds. any hints to get the analog Joystick inputs enabled?

#define ENABLE_LED_DEVICE
#define ENABLE_ANALOG_INPUT
//#define ENABLE_PANEL_DEVICE
#define NUM_JOYSTICKS 3
#define USE_MOUSE 0
#define USE_CONSUMER 1
#define USE_KEYBOARD 1

Share this post


Link to post
Share on other sites
  • 0

mmmh set joystick to 1 and disable the Pannel device the Pannel device has a own joy device that you can set ! mmhm show in the lufa framework in one file there are the USB discriptors for joystick 

Share this post


Link to post
Share on other sites
  • 0

Hi, thx for the update but ran into a problem after flashing it.

I´ve flashed your newest update build and after doing that the hardware is found under windows (im on win7 x64) but if i want to start e.g. your testapp it say´s "msvcr100.dll is missiing" but it´s installed. and the simpleledtest tool or VP with DOF it wont run anymore either.

I´ve tested it with the "normal" dll´s and with the ones in your foder. also test with different ID´s but nothing helped. Same when i put a self compiled version to the arduino.

When i flash the "old" version (18.12.2013 from Site 1) all is good and the arduino works fine with the simpleledtest and VP with DOF. 

Perhaps someone has a hint for me what i could try to make it run with the new update or self compiled version.

Share this post


Link to post
Share on other sites
  • 0

has you cchange the ID ?

 

and the Pinmapping has changed !

 

and has you flash via UUSB ASP ?

 

 

or try this

 

"regedit.exe"

 

 HKEY_LOCAL_MACHINE/ SYSTEM / CurrentControlSet / Enum / HID /   *and*   / USB / -> delete all entries with VID_FAFA*

 

Restart the Computer !

Share this post


Link to post
Share on other sites
  • 0

i changed the id a few times and try´ed it with 7 different id´s but that won´t help.

i saw that the pinmapping has change but i get this error also when the ardu is only connected to usb and nothing else.

and i flashed with flip and avr dude. first i put the orig firmware on it so i can write the new code to 2560 and after that flashing with flip. flashing is done without error´s.

must it really be programmed with USB ASP ?  

i will try it with my leonardo as icsp progger but first i try your regedit tip perhaps that´ll help.

thx for the tips so far

Share this post


Link to post
Share on other sites
  • 0

you can make it via flip no problem but i every time programmed it with an usb asp  

 

mmmh test it only in VP with the new code i have test it with the Ledlinky test tool and its hang but VP hasnt problems.

 

or i must find anybody to fix this problem i didnt know where the problem comes 

Share this post


Link to post
Share on other sites
  • 0

after deleting all FAFA entries out of the registry and rebooting i can now start the led blinky testtool but after making only one action (eg. switch port 2 on) it will hang up.

and then i have to reboot to make the testtool start again :( 

also try´ed it with flashing via icsp over my leonardo but that doesn´t make a change. 

will try it later after work with the new code and VP again but yesterday it start´s but no Led or solenoid is switched during play and when i exit VP it hang up also.

hope a solution can be found 

Share this post


Link to post
Share on other sites
  • 0

so i´ve try´ed it with only starting VP but it´s as before VP and B2S with DOF starts but no led or solenoid is switched. and when i exit VP i crashes and i have to stop it via taskmanager.

i have done the test with all 3 dll´s the orig one and the x86 and x64 you provided but all do the same crashes.

The funny thing is i´ve today plugged the ardu with the new code on a XP VM and there the ledblinky tool works fine without crashing after one action :) my VM machine is to weak to start db2s with DOF so i can´t test it in xp.

sadly as it is but I think for the moment i have to go back to the old code as this works perfect with all progs. perhaps a solution is found one day and then i can try to add accelo to the code ^^

Share this post


Link to post
Share on other sites
  • 0

poorly for me not only in the tools it´s dead also on VP DOF it wont work. don´t know why it´s working with DOF for you but here it does nothing and when i exit VP it will hang up and i have to close it via taskmanager.

i´ve tested some "selfcompiled" variations as well with the joysticks and other stuff deactivated but that does not help. i know to less about the hole coding things so i´m at the end of my knowledge and don´t know where to search.

in winXP it works also with the tools so it seems really to be a prob with win7. perhaps it´s just some simple thing but for now i´m clueless how to fix 

Share this post


Link to post
Share on other sites
  • 0

here´s a new found i made :) 

when starting the computer (with new code ardu plugged in) and i open the ledblinky testtool it opens but after one action it hang up. I have to close it via taskmanager. when i now try to open it again nothing happens. if i then unplug the ardu the tool pops up and when i plug the ardu in all works fine (without restarting the tool). but thats only as long as the prog runs. when i close it and want to start it again it won´t open till i unplug the ardu again. Same goes for VP with DOF. when i start DOF it won´t find the ledwiz but when i unplug and plug it in again it works. but i have to do that every time i start a new table ^^

don´t know if this will help in sorting things out but perhaps it helps

Share this post


Link to post
Share on other sites
  • 0

the file is not available any more and on github is see no changes so compiling it from there makes no change for me. will try it later again

Share this post


Link to post
Share on other sites
  • 0

so after redownloading and flashing the new code there´s poorly no change for me and the behavior is like i described it in post #48

also try´ed different id´s and to delete all the FAFA entries in the registry but that didn´t helped.

Only change is that now a Windows sound come´s when i unplug or plug it in that was not there before. But in the tool and DOF i always have to disconect and conect it to make it work

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

×