CATALOG

Unmanned vending machines are usually deployed in outdoor or semi-outdoor environments. Remote monitoring and fault warning of lighting equipment are urgent pain points in operation. Next, I will combine Thingboot’s open interface capabilities to write a practical solution.

Background and pain points

Let’s first talk about why this is worth doing. There are usually many ways of lighting in unmanned vending machines: shelf lights on the product display floor, ambient lights at the pickup port, and sign light boxes outside the cabinet. After all, 12-way lighting equipment is actually very common.

Where is the pain point? Think about it, if a certain street light is broken (for example, the middle display light does not light up), the glass window of the machine will be pitch black at night, and users will not be able to see the products clearly, and sales will be directly affected. The traditional method either waits for operation and maintenance personnel to conduct regular inspections before discovering it, or waits for user complaints. This is very passive.

Our goal is to:Realize remote status monitoring of 12-channel lighting equipment through Thingboot’s intelligent hardware and open interfaces——Whether the current of each street lamp is flowing, whether the lamp tube is burned out, and whether the relay is stuck can be clearly seen in the background.

Hardware selection

To achieve 12-channel control and monitoring, one controller alone is not enough. Here are two combination options, depending on your vending machine internal space and cost budget:

Plan A: Cascading plan (recommended, cost-effective)

use3 Core Steps "Intelligent Controller 4 Ways"cascade.

  • Why 3? Because this controller happens to have 4 outputs. 3 in series, exactly 12 channels.

  • Each controller supports WiFi 2.4G networking, so there is no need to buy an additional gateway.

  • The rated current of each channel is Max 10A, which is more than enough to carry lights and even small compressors.

  • focus: This controller hasindicator lightandstatus feedbackFunction. If the indicator light is always on, it means power is on; if it goes off, it means power is off.. What we want is this "status" data.

Plan B: Industrial module plan (suitable for high-end models)

Use third-party 12-channel intelligent lighting module (Modbus-RTU protocol)+ Thingboot 4G gateway.

  • This module has its own current detection function, which can measure the specific current value of each channel (such as 0.25A or 0A).

  • Connect to Thingboot's gateway through the RS485 line, convert the data into JSON format and push it to the cloud.

colloquial: If you just want to see "on/off", option A is enough, and the wiring is simple; if you want to see the "aging degree of the lamp" (current dropped from 0.5A to 0.2A), choose option B.

Interface integration logic

Thingboot’s open interface logic is very clear and consists of two main steps:Control deliveryandStatus reporting.

1. How to issue commands (turn on/off lights)

When you want to remotely turn off the 3rd light in the background, callDevice control interface.

According to the official documentation, you need to askhttp(s)://api.thingboot.com/{AppID}/device/control/Send request.Here’s a little trick: If you are using the three cascaded controllers, be sure to fill them in correctly.deviceparameter.

Request example (control the opening of channel 2 of the first controller):

Let me explain here. The document mentions that if you want to pass complex commands to the device, it is best to usePOSTway, and inorderinside biographyJSON. If you are worried about network packet loss, you can alsoorderRigaextraThe order number is included in the field to facilitate subsequent reconciliation.

2. How to obtain status (the core of "monitoring")

This is our focus today. What you want is not to "issue a command", but to "confirm that the light is really on."

Thingboot platform has two ways to obtain status. Monitoring must useThe second kind

Method 1: Synchronous return (not recommended for status monitoring)After issuing the command, the interface returns 200, but the document clearly states:"200 only means that the platform has received the command...the device may be offline". In other words, if you tell it to turn on the light, it will say "command received", but it will not care if the light cord is broken.

Method 2: Asynchronous message push (this is what we want!)When the device status really changes (for example, you press a physical button, or the light burns out and reports offline), the device will actively report the status.

You need to set up a receiving address (Webhook) on your own server, or use MQTT to subscribe to the topicapi/{AppId}/message/state.

The JSON structure actively reported by the device is as follows:

Actual combat logicIf you click "Turn off lights" in the background, thendatashould receive it"power": "0".if you receive"power": "1", that meansRelay stickingIf the light is not turned off, the alarm should be triggered to notify maintenance.

Specific implementation configuration of 12-channel monitoring

Suppose you have 12-channel lights, we need to give it a name to prevent confusion.

  1. device mapping

    • In the background of Thingboot, name the three controllers respectively.Light_Module_01(Corresponding to No. 1-4),Light_Module_02(Corresponding to No. 5-8),Light_Module_03(Corresponding to routes 9-12).

    • Record the uniqueness of each deviceDeviceID.

  2. Data processing logic (the code you need to write on the backend)You need to create a status table to record the latest status and last update time of each channel.

    lighting channelAssociated device IDStatus KEYCurrent statusLast heartbeat timedecision logic
    Shelf light 1ID_01power1110:00:01normal
    Shelf light 2ID_01power2109:30:00Alarm (not reported for more than 1 hour)
    ..................
  3. Heartbeat keep-alive mechanismEven if the light does not change, the machine should report the heartbeat regularly. If a certain channel does not send any message to the background for more than a certain period of time (such as 5 minutes), you should suspect that the power supply module of this channel has crashed, or the communication module has dropped offline.

Tips for actual wiring scenarios

After talking about the code, let’s talk about some real on-site construction experience.

What is used in unmanned vending machines12V/24V LED light stripThere are many, but the 4-way controller of Thingboot is220V ACOutput.Never connect the LED light strip directly, it will burn!

The correct connection method should be:220V mains power -> controller -> switching power supply (12V) -> LED light strip.

Because the controller is only responsible for "on and off" and controls the input end of the switching power supply. This not only protects the light strip, but also allows us to know whether there is a short circuit at the rear end through the feedback of the switching power supply. The "power status" you want to monitor is actually monitoring whether there is power coming from the 220V side.

Summarize

The benefits of using Thingboot to do it are visible to the naked eye:

  1. Remote fault location: There is no need to send people to the scene to turn on the lights one by one and check the lights. The background log directly showed "The 5th channel lighting feedback is abnormal". The operation and maintenance guy directly brought the accessories and replaced them, and it was done in one go.

  2. Energy saving in business: You can create a scheduled task through the interface. For example, when the passenger flow is low from 2 a.m. to 5 a.m., a command is issued through the interface to turn off half of the display lights; they will be turned on automatically at 6 a.m. This kind of instruction is passed through the core stepscheduled tasksFunctions can be configured in the cloud.

  3. Strong scalability: Thingboot’s interface not only controls lights, but also supports sensor linkage.. In the future, you can add a body radar sensor to the machine, which will automatically brighten the lights when someone approaches (send instructions through the interface), and dim the lights when someone leaves. This will have a great power saving effect.

Following this idea, the lighting system of unmanned vending machines can be transformed from "silly light" to "intelligent brain", saving both electricity bills and manual inspection costs.

照明控制器产品方案:
如何在智能家居中接入智能设备来实现分路控制灯光与电器
查看 >>
怎样在共享茶室照明控制中集成智能硬件来实现远程控制8路照明设备通断
查看 >>
怎样二次开发12路独立线路控制器来实现12路独立线路控制
查看 >>
怎样接入智能照明控制器|8路以实现远程开关状态查询
查看 >>
共享场所灯光管理:如何将12路远程灯光控制模块接入到项目中
查看 >>
无人售货机场景方案:
怎么在无人售货机灯光控制中集成智能硬件来实现12路照明设备电源状态监测
查看 >>
无人售货机电源控制:怎么将1位5孔WiFi智能插座集成到自己的项目中
查看 >>
怎么在无人售货机电路控制中接入智能硬件来实现电路状态反馈控制
查看 >>
无人售货机多回路设备控制:如何将16路分体远程场景联动箱集成到软件项目中
查看 >>
无人售货机电源控制:如何将10A86型电器开关对接到软件项目中
查看 >>
12路用途方案:
怎么在共享台球室灯光管理中接入智能硬件来实现远程控制12路照明设备通断
查看 >>
如何在厂房照明智能控制中集成智能设备以实现12路独立线路控制
查看 >>
怎么在智能公寓照明控制中对接智能设备来实现12路照明设备电源状态监测
查看 >>
如何接入12路远程灯光控制模块来实现12路照明设备电源状态监测
查看 >>
怎么二次开发12路智能照明控制终端以实现12路照明设备电源状态监测
查看 >>