|
Post by flyingalan on Apr 30, 2019 23:55:59 GMT
John, I have now wired the ADS1115 board with 4 pots connected. Before connecting to LC-DCC, I verified that the ADS board was working using an Arduino to display digital count for each channel in the serial monitor. I saw counts between approx 9 and 16000 as each pot was moved to each extremity (0-3.3V) with a count around 8000 for center detent.
When connected to the LC-DCC board however I cannot get any response. In windows, using an "engine button" I get error message "Controller error: !No POT" when selecting any of the "USE ADC Channel" numbers. Using BlueTooth, I used Analogue Configuration to tick all 4 enable boxes, however moving the potentiometers does not show any movement in the speed number or displayed loco slider in the DCC control screen. Should the screen speed number/slider respond when manual potentiometers are used/moved?
I have tried starting the LC-DCC with pots in center, and at extremities with no change.
Can you give any suggestion what I am doing wrong ?? I have verified SDA and SCL pins are connected to B11 and B10 and VCC is connected to 3V line.
regards Alan
|
|
|
Post by LC-DCC Designer on May 1, 2019 5:29:28 GMT
So can you put all pots to the center, then turn on the M3/M4 processor and on a tera-term type ?ADC ?POT1 ?POT2 ?POT3 ?POT4 and send me the output. Type each command followed by a line-feed.
Regards John
|
|
|
Post by flyingalan on May 1, 2019 8:26:44 GMT
Edited 11.20, had not restarted LC-DCC before using Teraterm
ADC:EN=1,SR=-1,SV=12088
P1,EN=0,VL=-1,SP=-256,EA=0,AC=-1 P2,EN=0,VL=11891,SP=-256,EA=0,AC=13219 P3,EN=0,VL=11967,SP=-256,EA=0,AC=13235 P4,EN=0,VL=11934,SP=-256,EA=0,AC=13291
Have tried swapping Pot 1 and 3 connections but POT1 still gives same answer so does not seem to be wiring connection problem on POT1 result.
regards
Alan
|
|
|
Post by LC-DCC Designer on May 1, 2019 10:55:29 GMT
So the ADC:EN=1 indicates the ADS1115 is connected to the I2C OK. And apart from POT1 the POTS seem to be giving values (AC values not -1). Can you put all POTS mid range (equates to speed zero) and then power on the processor board. The POTS are not enabled unless they are mid range at power up.
Regards John
|
|
|
Post by flyingalan on May 1, 2019 12:15:53 GMT
After re power, pots all set in center detent;
ADC:EN=1,SR=-1,SV=11681 P1,EN=0,VL=-1,SP=-256,EA=0,AC=-1 P2,EN=0,VL=12295,SP=-256,EA=0,AC=-1 P3,EN=0,VL=12290,SP=-256,EA=0,AC=-1 P4,EN=0,VL=11683,SP=-256,EA=0,AC=-1
Now different result ?? I have not connected PC or Tablet, just TeraTerm
regards Alan
further edit 14.50 When Bluetooth connected then previous results show again, i.e. P1,EN=0,VL=-1,SP=-256,EA=0,AC=-1 P2,EN=0,VL=12353,SP=-256,EA=0,AC=13059 etc, etc.
Alan
|
|
|
Post by LC-DCC Designer on May 1, 2019 18:17:00 GMT
Hi Alan,
You have found a bug with POT1, The other POTs will work OK. I will correct POT1 as soon as possible.
Expected output should look like:
?POT2 P2,EN=1,VL=13096,SP=0,EA=1,AC=13127
VL is the immediate ADC reading, AC is the center reading, SP is engine speed, EA is engine address controlled by POT, EN is enabled.
The software expects a center reading from 13000..13400 which is (0.5*32768*3.3/4.096)+/-200. This is the center for a 3.3V supply to the ADS1115. Without a valid center reading the POT will not be enabled. Are your POTs center biased ? Can you adjust the zero for each POT ?
Once a POT is centered you can use the P2EA= command to set the address (this is what the Android app and Windows app do). I know this sounds long winded but I didn't want an engine address being set with the POT at an extreme position and hence demanding full speed.
I hope this helps. To answer one of your other questions: the engine speed when adjusted is to any connected PC/phone or tablet but at the moment on the Windows application will convert the analog speed into a display output.
Regards John
P.S. Having looked at the code I think there is a simpler solution but I need to test it first.
|
|
|
Post by flyingalan on May 1, 2019 19:04:44 GMT
Great, thanks, your support is fantastic. I hope my building is helping debug the application. The code explanation is very helpful in understanding what I am seeing. I think we can now see the problem; At extremes with 3.2V measured across Pot, the count is approx 200 to 24,400 and the center detent measures approx 12,600. This is on all 3 working pots. So your center activation calculation of 13000 to 13400 does not apply and that is why it isn't working. All my pots have center detent and all give results around 12,600 to 12,800. I found I had very small volts drop originally on 3.3V line meaning only 3.1V was across Pot. Changing cables I now have 3.2V which is what I measure actually on the 3.3V pin of STM32F103. This has changed my center readings from original around 12,000 to now around 12,700. (Which still doesn't meet yor 13000-13400 requirement to activate. Looks like it is very sensitive to accuracy of the 3.3V rail.
regards Alan
|
|
|
Post by LC-DCC Designer on May 1, 2019 20:08:06 GMT
Hi Alan,
I appreciate all your help, you can imagine how much testing is needed. What I think is best is to start with POTs at their upper limit value and read this at power on. Then assume that center is half this voltage and use this to detect POTs at "zero speed". So POTs will be enabled when the reading is greater than say 3.0V. POTs will only become active for an engine when they are at or near "zero speed" as the current design.
I think this will work better than current design and overcome your problems. I will start updating the software as soon as I can and generate a new release as soon as possible.
Regards John
|
|
|
Post by flyingalan on May 1, 2019 22:01:32 GMT
Yes, I agree, unfortunately even a .1V difference in the 3.3V line is around 3 percent change so it makes it impossible to set a calculated fixed window on the output value of around 1 percent. You could maybe try to read the 3.3 line actual voltage percentage error and then calculate and adjust the window center value by that percentage to compensate. Happy to help, let me know if you want me to try anything before release. regards Alan
|
|
|
Post by flyingalan on May 2, 2019 14:02:19 GMT
John, just FYI, I got one pot to work by manually setting it to a point where it gave 13200 count which LC-DCC recognised on starting, and allowed it to work. I activated it on tablet app. I could see it working in Teraterm on PC giving speed step information as I adjusted the pot. I then closed Teraterm and opened LC-DCC on PC, set up an engine button and set analogue pot to working number. This worked fine and the slider on PC display moved as I adjusted the manual potentiometer. However on the tablet Bluetooth display although the selected address showed a red box marked "Analogue" for the appropriate address, the speed slider did not move or follow any manual potentiometer adjustment. So to sumarise Windows app display seemed connected to manual pot adjustment and slider moved in response but the tablet Bluetooth display although indicating an analogue connection, the speed slider did not follow the potentiometer adjustment. Not sure if this is intended, or a bug, but just to let you know what I found. regards Alan
|
|
|
Post by LC-DCC Designer on May 2, 2019 20:19:13 GMT
This is expected as I have not yet added analogue speed decode support in to the Android application.
|
|
|
Post by LC-DCC Designer on May 12, 2019 9:25:42 GMT
A new version 12.05.19 for ADC potentiometer control can be downloaded from www.swws.co.uk/lc-dcc-files.html. This has been modified to overcome the voltage drop described. All potentiometers must be set to maximum voltage before the LC-DCC system is powered, this voltage will then be used for speed and center calculations. I have also added a speed profile so that there is more low speed control near the center of the potentiometer. When setting an engine address for potentiometer control or when using the emergency stop feature the potentiometers will become deactivated until the potentiometer is moved to the center (zero speed) position.
|
|
|
Post by flyingalan on Jun 26, 2019 16:30:33 GMT
Hello John, Having been busy recently,I have only just got back to the LC-DCC project. I wondered if you have made any progress on the Android application interfacing to the analogue potentiometers and showing position ? I have now got my tablet and 8 center notch slider potentiometers mounted in an enclosure, just waiting for PSU parts to arrive from China. In previous correspondence you mentioned that it may be possible to extend the number of pots from 4 to 8 so I have provisioned 8 on my panel in the hope that in a future release you expand the analogue pot number.
regards Alan
|
|
|
Post by LC-DCC Designer on Jun 26, 2019 19:24:24 GMT
Hi Alan,
Here is my current road map:
1. Tidy up engine windows on the Windows application (correct delete button function). 2. Release 2.2 of Windows application. 3. Finish Android updated to include 11 accessory buttons and one general accessory button on each engine control screen, add analogue speed decode. 4. Release a pre-built 2amp LC-DCC controller for sale on EBay. 5. Add another I2C ADC to support 8 engine speed potentiometers. 6. Release a pre-built 6amp WIFI LC-DCC controller for sale on EBay. 7. Look at creating an iPhone version of the Android application depending on demand and app-inventor IOS support.
I hope this is enough information, they will be done as time permits, but I hope all will be completed this year.
Regards John
|
|
|
Post by flyingalan on Jun 26, 2019 21:49:57 GMT
Thanks
|
|