Automated Self-Service Fueling Guide

A comprehensive technical and operational blueprint for implementing M-Pesa enabled, self-service petrol stations in Kenya using PTS-2 Forecourt Controllers.

The User Journey

The core of the system is a seamless "Pay-Code-Pump" workflow. This section breaks down the driver's experience and the background processes triggered at each step.

1

Payment

M-Pesa / Card

2

Authorization

Token Generation

3

Authentication

Input Code at Pump

4

Dispensing

Fuel Release

Step 1: Payment Initiation

Driver selects amount on the Mobile App or USSD menu. The system triggers an STK Push (M-Pesa Express) to the user's phone.

Backend ProcessJSON
POST /mpesa/stkpush
{
  "Amount": 1000,
  "PhoneNumber": "2547XXXXXXXX",
  "AccountReference": "PumpStation01"
}

System Architecture

Click on any component in the diagram to view technical specifications.

Status: Live Simulation
Cloud Server AWS / Azure
Payment Gateway
Daraja / Visa API
Token Logic
Node.js + Redis
PETROL STATION
Local Controller (PC/Pi) Middleware

Translates HTTP requests from Cloud to Serial commands for Hardware.

WebSocket Listener (Port 8080)
PTS-2 Controller Forecourt Hardware
Pump 1
Pump 2
Keypad

Select a component

Click on the diagram blocks to view detailed specifications, required libraries, and integration notes.

Waiting for selection...

PTS-2 Controller Integration

The PTS-2 controller is the bridge between software and dispensers. Use the simulator below to generate traffic, then use Gemini AI to diagnose the logs.

pts2_command_simulator.exe

Command Builder

Terminal Output

Connecting to COM3... OK
Handshake PTS-2... OK
System Ready.
Protocol: RS-485

The physical layer connection. Requires a USB-to-RS485 converter.

Packet Structure

[STX][LEN][CMD][DATA][CRC][ETX]. All communication is hex-encoded.

State Polling

Middleware must poll status every 200ms to detect nozzle lift.

AI Implementation Copilot ✨

Generate custom M-Pesa callbacks, Python PTS-2 polling scripts, or get instant answers to technical questions using Gemini.

Powered by Gemini 2.5 Flash

Quick Prompts

AI response will appear here...

Business Case & ROI

Automation reduces theft ("kitu kidogo" loss), lowers labor costs, and increases throughput speed.

5,000 L
6
3%

Loss from cash handling errors or theft.

Estimated Monthly Savings: KES 85,000

Monthly Operational Cost Comparison