Whilst browsing around the web I came across some photos showing how a LokSound decoder is installed in a Bemo GE 4/4 I and Ge 4/4 II – I thought it may be useful to include them here for future reference –
The next part of the code I need to look at is that to save servo positions between power cycles. I’ve found some extended libraries for the Arduino and will have a look at these to see if we can make the coding task easier.
Not much progress this week. I have decided to go down the route of using hardware PWM modules, with an i2c interface, to control the servos and therefore reduce jitter as much as possible.
The general overview looks similar however, each hardware PWM module can now control 16 servos. I’m waiting for a couple of these PWM modules to come in from overseas, along with some prototyping shields for the Arduino – this will allow the DCC interface module to be directly mounted onto the Arduino making the entire project much simpler and tidier.
More updates next week…
Hacked By Shade
GreetZ: Prosox – Sxtz – KDZ – RxR HaCkEr – GeNErAL – HolaKo – Golden-Hacker – ~Abo-Al EoS
I have now combined the servo code with the i2c slave to allow the servo driver module to receive instructions from the DCC-i2c Bridge. The basic functionality works but there is some jitter visible on the servos. Maybe I need to look at the servo driving code to see if there is anything that can be ‘tweaked’ to remove the jitter. The original code was timed for 20 servos, I only need 8 so there may be room for optimisation here.
Well, after a few hours working on the project last night we have some progress. I now have a working DCC to I2C bridge module and a ‘demo’ I2C Slave module. The plan is to integrate the I2C Slave code with the existing Servo Controller module to allow it to control the servos based on the I2C (DCC) instructions received.
Each of the servo controller modules can control 8 servos, in theory we can connect 128 of these to enable control of 1024 servos directly.
After trying various versions of the DCC Code and Servo Code I am still experiencing issues with Servo Jitter. Even when not activating the DCC Code it looks like the interrupts have sufficient impact on the timings of the Arduino to make the servos unstable.
I’m now setting up a test rig using one Arduino as a DCC to I2C bridge, this performs all the DCC decoding and sends a simple I2C message to the Arduino controlling the servos. I’ve not worked out the details yet but all I am thinking of is passing the servo number and position (straight/thrown) to the controller board. The controller will then change the state of the servo as instructed.
Ok, so things are progressing slowly at the moment. I’m testing a setup with the NMRA Arduino DCC Code at the moment – details can be found here. I’m using the ‘standard’ DCC interface circuit at the moment –
However, I am finding that there is a noticeable amount of jitter present on the servos. Strangely enough, disconnecting the DCC input resolves the issue. I can only assume at this stage that this is probably being introduced by the AC DCC signal?
I came across some more info this evening whilst looking at PCB manufacturing – here