Call the free blink decode API endpoint
Put the bits in the path:
curl https://aisenseapi.com/services/v1/blink_decode/101010001110111011100010101{"coding":"morse","text":"SOS","morse":"... --- ...","unknown":[],"unit_ms":100,"quality":1,"inverted":false}Or post the brightness of a square in each camera frame, with the frames per second:
curl -X POST https://aisenseapi.com/services/v1/blink_decode \
-H "Content-Type: application/json" \
-d '{"levels": [20, 20, 20, 200, 200, 200, 20, 20, 20, 20, 20, 20, 20, 20, 20, 200, 200, 200, 200, 200, 200, 200, 200, 200, 20, 20, 20], "rate": 30}'{"coding":"morse","text":"ET","morse":". -","unknown":[],"unit_ms":100,"quality":1,"inverted":false}The way there is the blink encode API endpoint.
Try it / Receiver
Read a blink with the camera
Film the blinking square, and the brightness in the marked frame becomes text.
- Open the sender on a laptop or another screen.
- Choose Start camera here and fit the square in the marked frame.
- Choose Blink there. The text comes when the square stays dark.
While it films, the timer also shows how many frames a second this camera gives. The 60 ms unit on the sender needs about 60; the slower units read at 30.
The camera starts only when you choose Start camera, and the picture stays in your browser. Only the brightness of the marked frame, one number a frame with its time, goes to AI SENSE when the blinking stops or when you choose Stop and read. Cancel sends nothing.
The message
The answer
Signals it reads
Send one of these in a JSON body, at most 200,000 values:
bits, a string of0and1, one character per unit, as the encode endpoint answers it. In the path it is/blink_decode/{bits}, or/blink_decode/{bits}/{unit_ms}to name the length of a character in the answer, 100 ms by default.durations, the lengths of the on and off runs in milliseconds in turn, the first one on, as the encode endpoint answers them intiming.levelswithrate, one reading per sample, such as the mean brightness of a square in each camera frame, and the samples per second.levelsas[milliseconds, level]pairs, for frames that come unevenly.
curl -X POST https://aisenseapi.com/services/v1/blink_decode \
-H "Content-Type: application/json" \
-d '{"durations": [100, 100, 100, 100, 100, 300, 300, 100, 300, 100, 300, 300, 100, 100, 100, 100, 100]}'{"coding":"morse","text":"SOS","morse":"... --- ...","unknown":[],"unit_ms":100,"quality":1,"inverted":false}curl -X POST https://aisenseapi.com/services/v1/blink_decode \
-H "Content-Type: application/json" \
-d '{"levels": [[0, 20], [40, 22], [70, 21], [101, 198], [134, 205], [168, 201], [199, 19], [233, 24], [266, 20], [300, 22], [333, 18], [366, 21], [401, 23], [433, 20], [467, 21], [500, 199], [534, 202], [566, 200], [600, 204], [633, 198], [668, 201], [700, 203], [733, 199], [766, 200], [800, 21], [833, 20], [866, 22]]}'{"coding":"morse","text":"ET","morse":". -","unknown":[],"unit_ms":99.6,"quality":1,"inverted":false}How it reads
- A median of three takes out a glitch in one frame. The levels split into two groups halfway between their means, with a margin on each side, so noise near the middle does not switch the state.
- The level at both ends of the series is taken as off, since a signal starts and ends idle. A screen that goes dark to signal is found that way and the answer says
"inverted": true. Sendinvertto say it yourself. - Runs shorter than a third of the unit are flicker and join the run before them.
- The unit is the one that fits the runs best to 1 or 3 units on and 1, 3 or 7 units off. A message of one letter has runs of one length only and is read at the unit nearest 100 ms, so send
unit_mswhen it went out at another. qualityis the share of runs within a quarter unit of the 1, 3 or 7 units they were read as: 1 for a clean signal and lower for a noisy one.- Record a few units of idle before and after the message, and at least three samples a unit. A camera at 30 frames per second reads 100 ms units in a steady picture and needs 150 ms or more when the picture flickers.
The answer holds text in upper case, morse as read, unknown for sequences without a character, the unit_ms found, quality and inverted. A dark signal on a bright screen:
curl -X POST https://aisenseapi.com/services/v1/blink_decode \
-H "Content-Type: application/json" \
-d '{"levels": [230, 230, 230, 15, 15, 15, 230, 230, 230, 230, 230, 230, 230, 230, 230, 15, 15, 15, 15, 15, 15, 15, 15, 15, 230, 230, 230], "rate": 30}'{"coding":"morse","text":"ET","morse":". -","unknown":[],"unit_ms":100,"quality":1,"inverted":true}Errors
| Status | error | When |
|---|---|---|
| 400 | Send one of bits, durations or levels. | None of the three, two of them, or a body that is not JSON |
| 400 | bits is a string of 0 and 1. | Anything else in the bits |
| 400 | durations is a list of positive numbers of milliseconds, the first one on. | A length that is no number or not above 0 |
| 400 | levels is a list of numbers, or of [milliseconds, level] pairs. | A level that is no number, or a pair of another size |
| 400 | rate is the number of levels per second, above 0 and at most 100000. | Plain levels without a rate, or a rate out of range |
| 400 | The times in levels must rise. | A pair with a time no later than the one before |
| 413 | At most 200,000 bits, durations or levels. | More samples than that in one request |
| 400 | unit_ms is a number of milliseconds above 0 and at most 60000. | A unit out of range |
| 400 | invert is true or false. | Another value for invert |
| 400 | coding is morse or auto. | Another coding was asked for |
| 400 | The levels never change, so there is no signal to read. | One level throughout |
| 400 | No Morse could be read from the signal. | No letter came out; the answer still gives the code read, unknown, the unit and the quality |
Each refusal also carries fix, a sentence saying what to send instead.
Common uses
Read a blinking screen with a phone
Measure the brightness of a square in each camera frame and send the levels with the frame rate.
A light sensor on a small board
Send the readings of a photodiode, and let the endpoint find the threshold and the unit.
Check what a device sends
Record a status light or a buzzer as on and off lengths and read the code it keys.
Agents
Through the MCP server the same decoder is the tool decode_blink.
Privacy and limits
Nothing is stored. The blink decode answer is worked out while the request is open and the signal is gone with it. The access log records the path and the status. A text or bits sent in the path are part of that path, so post them when they should not be logged.
The base URL is https://aisenseapi.com/services/v1. There is no key, no account and no sign-up step. An encode takes at most 128 bytes of text and a decode at most 200,000 bits, run lengths or levels, and the service-wide limit is 5000 requests per IP address per day. Every endpoint in the collection is listed on the Free public REST APIs reference, and the encodings side by side on Encoding APIs.