Jump to content

Ledwiz Speedtest


Maniac

Recommended Posts

I've written a small script that (hopefully, since I don't own a LedWiz myself I can't test it) measures the time the LedWiz needs to submit a command.

The script sets all PWM outputs to maxium (48) and then switches all outputs on and off 20 times. This means 40 operations in total.

 

At the end the overall time and per call time is displayed.

 

Someone who has deeper knowledge please check if the LedWiz commands are correct. I've tested the script using an Arduino instead of a LedWiz.

 

Please post your values in this thread.

 

Here is the script. Copy it into an empty file and name it speedtest.vbs

 

 

Set LedControl = CreateObject("LEDWiz_Control.LED_Wiz")
LedControl.Command ="PBA:48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48"
LedControl.Command ="SBA:0,0,0,0,1"
i = 0
t = Timer
temp = Int(t)
StartMs = Int((t-temp) * 1000)
StartS = temp mod 60
while i < 20
LedControl.Command ="SBA:255,255,255,255,1"
LedControl.Command ="SBA:0,0,0,0,1"
i = i + 1
wend
LedControl.Command ="SBA:0,0,0,0,1"
t = Timer
temp = Int(t)
EndeMs = Int((t-temp) * 1000)
EndeS = temp mod 60
DurationMs = EndeMs - StartMs
DurationS = (EndeS - StartS) * 1000
Duration = DurationS + DurationMs
WScript.Echo "running time complete: " & Duration & "ms. per call: " & Duration / 40 & "ms"

 

Edit: For reference this are the values I currently get with my Arduino (PWM routines enabled). But there is still some room for improvements.

Overall: 6843ms

per call: 171ms

 

Edit: Please also do a second run and exchange the line

LedControl.Command ="PBA:48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48"

to

LedControl.Command ="PBA:40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40"

 

This should enable PWM on all ports and we can see if it makes a difference in processing time on the ledwiz itself.

Link to comment
Share on other sites

I've optimized the Arduino a bit and use hardware SPI now.

 

With full PWM (PWM always enabled in firmware currently) I got the following values now:

Overall: 1398ms

per call: 34,95ms

 

This is a lot faster than software SPI, but still slower as the LedWiz (wihtout PWM). The firmware is currently running on an Arduino Leonardo which provides a virtual com port (the UNO uses an extra microcontroller which does the serial stuff and connects it to the hardware com on the Atmega).

Link to comment
Share on other sites

Thanks, then it makes no difference for the communication if PWM is enabled or not for the LedWiz too.

 

I just recognized that my PWM timer in firmware was still on 20 microseconds. This makes no sense in a productive environment and it was a just for fun test before switch over to hardware SPI.

 

After rising it to 200 microseconds (which is still fast enough) I got the following results:

 

Overall: 12ms

per Call: 0,3ms

 

Now I'm happy because all my Arduino work is a huge improvement at all :)

 

 

Here is a deeper description to the per call value which is measured by the script:

At default the ledcontrol.vbs updates the Output every 60ms and sends it to the LedWiz. If a lot of lights are changing this can happen every 60ms. Now the LedWiz takes 16ms to give the control back to VP. VP itself sleeps in this time and this causes the stutter.

Link to comment
Share on other sites

It should be help alot, because it reduces the waiting time for each command in VP from 16ms to 0,3ms. So nearly all of the stutter should be gone. Please note that you also need a controller board which you connect to the Arduino to have the outputs available. Since I've switched to an Arduino Leonardo it will be easy to create a PCB containing the Atmega32u4 (or smaller 32u2) directly on the controller board, so there is no need for an extra Arduino. Since you need the Controller Board in both ways this would cost about 20€ less. I'm planning to create such a PCB, including the possibility to daisy-chain the boards if you need more than 32 outputs and I want to ad a connector to drive Zebulons board also.

 

There is still room for improvement on the ledcontrol.vbs side. Currently every 60ms the ledcontrol.vbs sends commands to VPM to ask for the lamp status, causing a little load at VPM. Currently there is no other way to obtain this information. The best solution for this would be to change the way VP and VPM interacts (like using VPM as a library in VP). So that VP always knows the state of all lamps and we can ask VP for this information.

Link to comment
Share on other sites

wow this sound great, I have  Zebulons great booster board which somehow should allow an arduino board to drive it.  Getting rid of stutter is my main goal now, along with maybe adding more outputs, as it gets addicting adding forcefeedback and leds to cabinets :)  Please keep us informed as you work along this project, very interesting.  

Link to comment
Share on other sites

  • Content Provider

i can't launch the speedtest.vbs

 

i have the error an activex component can't be created: ledwiz_control.led_wiz

 

i have created the file speedtest.vbs

 

do we launch it directly or from another executable?

Link to comment
Share on other sites

You can launch it directly. But if you use a 64 bit windows, you have to run it with the 32 bit wscript.exe.

 

Please follow those steps:

- click Start

- write "cmd" without the quotes

- press enter

- in the window that opens type "c:\Windows\SysWOW64\wscript.exe path_to_speedtest\speedtest.vbs" without quotes and replace the path_to_speedtest with the path where you have placed the speedtest.vbs

Link to comment
Share on other sites

  • Content Provider

My post was lost during the maintenance.

 

I can run it now, and my result is far better than what i have seen with other ledwiz users.

 

40 ms in total and 1 ms per call, with a ledwiz

 

Using w7 64 bits, with a intel i7 3770 (3.4 ghz), 8 gb ram 1600 mhz

Link to comment
Share on other sites

running time 640ms


per call  16ms


 


I have an intel i7 3.4 also, strange


 


I do get stutter once and a while with lots of lights going off and VpinMame sounds at the same time.  This is the last big thing to fix in VP.  I hope an arduino can come the the rescue to fix the stutter of an ledwiz.  I had to take out fastcom=true on my system as it caused strange assignments to the ledwiz, but did seem to make things run much more smoothly, dam.


Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...