CATALOG

1. Why do vending machines need "smart lights"?

Let me ask you a question first: When you pass by an unmanned vending machine at night, do you hope that it will "light up" to attract your attention? But don’t want it to be on 24 hours a day and waste electricity?

This is the pain point of vending machine lighting control——It is necessary to attract customers "visibly" and to control costs "sparingly".

The traditional approach is: either keep it on (which consumes electricity and has a short lamp life), or install a voice control or light sensor module (which has a single function and is not flexible enough).. And now there is12-way intelligent lighting controller, you can independently control every shelf, every advertising light box, and every area in the vending machine. You can open it in whichever way you want, and when you want to open it.

I will combine it belowcore stepOpen interface, talk about how to integrate this "12-way controller" into your own project.

2. First understand: What is a 12-channel intelligent lighting controller?

To put it bluntly, this thing is a"Switch box" that can be controlled remotely via the Internet.

One end of it is connected to the lamp (LED light strip, spotlight, advertising light box, etc.), and the other end is connected to the cloud through the network (WiFi or 4G). You send a command to the cloud through the API, and the cloud forwards it to the controller, and the controller turns the corresponding light on or off with a "click" sound.

Number 12 means:It has 12 independent switching channels. You can plan like this:

aisleControl objectuse
Channel 1Top main lightingAttract customers from afar
Channel 2Merchandise shelf shelf lightsLight up the first layer of merchandise
Channel 3Merchandise shelf shelf lightsIlluminate second-tier merchandise
.........
Channel 10Advertising light boxShow brand
Channel 11Pick-up port lightingConvenient to bend down to pick up goods
Channel 12Ambient light stripIt was a bit "powerful" at night

With Thingboot’s hardware, these channels can passHTTP request or MQTTto remote control.

3. Core integration steps (from zero to one, no nonsense)

Step One: Hardware Preparation and Wiring

  1. After getting the device, first find the device ID——This ID is on the label on the device shell and is also in the Thingboot console.. Make a note of it, you will need it for all subsequent API calls.

  2. Connect the lamp to the controller: 12 channels of output, each channel has two terminals: "live wire in, live wire out". Connect the live wire of the lamp to the output end of the corresponding channel, and the neutral wires are directly connected together to the neutral wire row.Note: The controller itself requires 220V power supply, don’t connect it wrongly.

  3. Power distribution network: Follow the instructions to connect the controller to WiFi (Thingboot’s device supports setting up 5 groups of WiFi and will automatically switch to the one with the strongest signal). After connecting to the Internet, you should see the device status change to "online" in the console.

Step 2: Understand how to adjust the API (key link)

Thingboot’s open platform isFree forever, there is no charge for either HTTP or MQTT.. This is very conscientious.

Interface address (HTTP mode)

http(s)://api.thingboot.com/{Your AppID}/device/control/?sign={Signature}&ts={Timestamp}

Required parameters

  • device: It’s the device ID I just remembered.

  • order: The command you want to give, for example, if you want to open channel 1, just pass{"ch1":1};To close channel 1, pass{"ch1":0}

Give a chestnut: You want to turn on the 1st channel (top main lighting), turn off the 3rd channel (the second shelf light), and open the 5th channel (advertising light box).

Using POST method, the JSON parameters are written as follows:

How does a signature count?

sign = md5(md5(your developer password) + ts)

ts is the current timestamp (10 digits). The signature must be recalculated for each request. This is to prevent the interface from being called randomly by others..

Step 3: Implement the call in your code

Whether you use Python, Java, PHP or Node.js, you are essentially sending an HTTP POST request. Let’s demonstrate it using Python (the most intuitive):

Notice: Returning code=200 only means that the platform received the instruction and successfully issued it, but it does not mean that the device actually executed it. If the device is offline or the light is broken, you can still see 200 here. So if you need to "confirm that the light is on", use Thingboot'sAsynchronous message pushFunction - After the device completes execution, it will actively push you a confirmation message.

Step 4: Design your "lighting logic"

After the hardware is connected and the interface is adjusted, it’s time to get creative. Here are some common scenarios for you:

Scene 1: When someone comes, the light turns on, when someone leaves, the light turns off

  • Add a human body infrared sensor to the vending machine (or use its own camera for human body recognition)

  • When the sensor triggers, call the API to open all light channels

  • Set a timer, for example, if there is no new trigger after 30 seconds, call the API to turn off all the lights.

Scenario 2: Time-based control

  • During the day (8:00-18:00): Only turn on the product shelf lights and turn off all ambient lights (to save power)

  • Evening (18:00-22:00): Fully open, blinding the eyes of passers-by

  • Late night (22:00-6:00 the next day): Only the advertising light box is kept, and everything else is turned off

This is usedscheduled tasksIt can be achieved - run a cron job on your server and call the API when the point is reached.

Scenario 3: Combined with transaction process

  • After the user scans the QR code to purchase goods and successfully pays, the lighting at the pickup port will be automatically turned on for a few seconds.

  • Or when a certain product is out of stock, use flashing lights to remind replenishment personnel (for example, let No. 8 switch on and off three times in a row)

Scenario 4: Remote debugging and maintenance

  • The operator clicks "One-click to turn on the lights" in the background to remotely view the status of the shelves inside the vending machine (camera cooperation)

  • You can confirm which lamp is broken and needs to be replaced without going to the scene.

4. Common pitfalls and pit avoidance guide

Pit 1: What should I do if the device is offline?Thingboot's equipment uses WiFi to connect. If the vending machine is placed in a basement with poor signal, it may drop out. : When configuring the network, fill in different hotspots for each of the 5 WiFi groups (for example, write in both 2.4G and 5G), and the device will automatically switch.. In addition, your code must handle the error code returned by the API - if the control fails three times in a row, send an alarm to the operation and maintenance personnel.

Pitfall 2: Will it crash if you control too many devices at once?The API supports issuing commands to up to 100 devices at a time., the 12-channel controller is just one device, no problem at all. But pay attention to the frequency limit:A single device accesses up to 1 time/second. You don't need to adjust it every second - the user is not the Flash.

Pitfall 3: My project is an App/mini program/official account, can it be used?It works. Anyone can adjust the HTTP interface. If you are doing an IoT platform-level project, useMQTT method(long connection, better real-time performance). Thingboot’s MQTT address ismapi.thingboot.com:1883, the username is AppID and the password is AppSecret.

Pit 4: The light flashed and then went out?There is a high probability that you have misunderstood the "switch command". In some controllersch1=1Some are "clicking" (lights up once you press them), and some are "self-locking" (lights up all the time when you press them once, and turns off when you press them again). Check your product manual to confirm what the instructions mean.

Pit 5: Does the vending machine itself have lights?Some vending machines come with lights from the factory, but they are usually connected in a row in parallel, and each layer cannot be controlled individually. What the 12-way controller does isReplace the original direct power supply——Cut off the power supply line of the original lamp, and connect the relay output end of the controller in the middle.

5. Advanced gameplay (if budget and energy allow)

  • Add a light sensor: Let the system automatically detect the ambient brightness. Turn on the lights when it gets dark and turn them off automatically when it gets dark, saving more power.

  • Make a visual backend: Draw a 3D model of the vending machine on the web page, and click on which layer to light up the lights. This is especially intuitive for operators to perform remote inspections.

  • Connect with the payment system: After the payment is successful, a "light show" will be played - the lights on each shelf will be lit in turn, and the final pick-up port will flash three times. The user experience is amazing.

  • Abnormal alarm: If the current of a certain channel is abnormal (such as the lamp is broken or short-circuited), the controller can detect it and report it through the API. You can automatically generate a maintenance work order after receiving the message in the background.

6. Summarize

Integrating the 12-channel intelligent lighting controller into the unmanned vending machine project actually involves three things:

  1. wiring: Connect the light to the controller, power on the controller and connect to the network

  2. Call API: Using Thingboot’s open interface, you can switch each channel on and off with just a few lines of code.

  3. write logic:Write control rules according to your business scenarios (human trigger, timing control, transaction linkage)

Thingboot's open platform is permanently free, and the hardware is not expensive, with a 12-channel controller costing several hundred yuan. After all, if a vending machine can save a few kilowatt-hours of electricity every night by relying on "smart lights", the hardware cost will be saved in a few months. Not to mention the positive cycle of "good lighting effects → attracting more people → selling more goods".

If you still have questions, go directly to Thingboot's open platform to read the documentation, or find their technical support - it's free anyway, no questions asked.