I am designing a WiFi enabled DALI control device. I have some control gears which already have short addresses, are connected on DALI lines. I want to scan the control gears and store their short addresses in my cell phone app. We have developed a cell phone app which can do so. What should be the commands or queries that i should use to do so? I tried to send query short address command, but it does not work because the gear is not physically selected. What is the best suitable method to do this?
Scanning DALI control gears
dali
Related Solutions
Adding as a seperate answer because the new question is different from the original:
Your Manchester decoding is correct but the bit order is b8-b7 etc to b0 so you have the bit decoding backwards. The set bits are b2 = arc power ON and b4 = Fade is running. These make sense as you have sent broadcast DAPC to level 0xA0 and have set a long fade time (5.6 seconds.
There are multiple errors in your command listing
- msg 5 0xA370 would store 0x70 in DTR, presume you mean 0xA307
- msg 8 0x072E stores DTR as fade time in gear with short address 3. DTR 7 means fade time is 5.6 seconds. If you want 16s, DTR should be 10 = 0x0A.
- msg 3 & 4 & 10 Intialise and Terminate are only needed for the programming the short address commands (the randomise and binary search), not for setting configuration values like fade time and group addresses.
- msg 12 queries status of gear at short address 3.
I'd get rid of the extra messages, have one gear on the bus, use broadcast messages and command 146 so you don't even have to interpret bits, it's either responding or not. Frankly, the number of errors made in your amended question doesn't give me confidence in your code. However, since the gear is reporting to be on, a missing lamp should give you a lamp fail. It doesn't matter when the lamp was removed. There are many electronics causes for lamp fail to be reported, depending on the lamp technology. For fluorescent lamps it is not just current from one end to the other, it can be broken heater wires at one end or failure to start up after a defined strike period, or some other reason found when monitoring the currents and voltages of the tube.
Edit: now that the question is specifically about LEDs, IEC6236-207 is applicable.
Command 240 Query Features tells you if the gear supports such things as open circuit detection, load decrease detection, thermal shut down, current protection etc. If your gear tells you it doesn't detect open circuit or detection of load decrease (bits 1 and 2) then you are not going to get lamp fail detection from this gear. But if it does, you could determine which type of lamp failure had occurred with Command 251, Query Failure Status which responds with bit 1 for open circuit and bit 2 for load decrease.
Note that commands above 236 are Application Exended Query Commands which mean they need preceeding by Command 272 Enable Device Type with data 6 (for LEDs).
The response to Command 146 Query Lamp failure, and bit 1 in the response to Command 144 Query Status are the result of an OR operation on the bits 0 to 4 in the Failure Status reported in Command 241 Query Failure Status.
In summary, I think this particular gear does not detect lamp failure as an open circuit condition, and it probably doesn't detect lamp failure as other conditions either; you're query is correct but just not supported by the gear.
Start with Command 145, Query Ballast, sent broadcast. If you get no response to this, there are a few possibilities.
- the gear is not connected or does not have mains power
- There is too much cable between the power supply/query end and the gear, there is a 2V maximum volt drop specified
- the gear has a broken transmit transistor, caused by the use of an unlimited or too high a limit on the current limited supply. DALI supplies must be limited to 250mA maximum.
- the gear meets edition 2 of IEC62386-102 and is in an Operating Mode other than Mode 0.
- The receiver does not have its threshold voltage between the specified limits.
Once you have fixed this, the command sequence to set a short address when you only have one gear on the bus is
- Set the DTR to the required short address in the special format (shifted left one place, least significant bit set to 1).
- Read the DTR to check that it is correct.
- Send Command 128 Store DTR as Short Address, twice within 100ms, using broadcast addressing.
For this command sequence when you only have one gear on the bus, you do not need to send the Initialise or Randomise command. Whilst it is possible to commission many gear this way, by connecting or powering up one at a time and assigning unique short addresses, it is not normally done this way because of the inconvienience of having to ensure only one gear is on the bus at any one time. Then the randomise method is used, with all the gear powered up at once. Note that with the randomise method, some commands such as Initialise have to be sent twice in 100ms, and that the Program Short Address command is only executed inside gear where the 24 bit search address matched its random address, so your command sequence is incorrect.
My experience with Meanwell gear is that this should work unless you have broken your unit or have field wiring problems.
Best Answer
As you have found out, Command 269 Query Short Address only works if the gear is physically selected or the random address is equal to the search address, and only while the 15 minute initialise timer is running. This command is to be used during addressing. At other times, you can use any query which is sent using short addressed addressing to see if you get a response. Typically systems will use Command 145 Query Control Gear to see if there is a gear at that address. You may find it preferable to use Command 153 Query Device Type since you get a response that tells you more than whether there is a gear at that address, it tells you the type. Although there is Command 150 Query Missing Short Address, this would be no more useful in this situation than the other queries I mentioned if you sent it using short addressed mode, it is generally more useful in broadcast mode with only one gear on the line.
With any of these queries, you have to scan through all possible short addresses to see if you get a response. I would not recommend stopping as soon as you find a No because there is no requirement in DALI to keep the short addresses adjacent with no gaps.