New website!

Scramjet and IoT

Scramjet loves IoT. The framework can easily gather data from multiple sources, make simple or complex transformations, aggregate the data and send it upstream. It's low memory footprint allows running complex transforms on SoC type boards like Raspberry Pi and similar. The framework itself with all the bundled methods will take up to 1 megabyte of memory, with node taking approx. 20 megs.

Although this may not be much and I can only tell that we have some future alternative in mind, I agree this doesn't allow you to run scramjet near the sensors on strictly low memory software.

Low frequency radio

Let's consider the use of scramjet in gathering data from an array of sensors using LoRa (low frequency, high range radio, here's an article about it) using lora-comms. Our sensors are soil gathering temperature and humidity data, based on this we'll control the irrigation system in real-time.

Let's start with our requirements:

// npm i -s lora-comms lora-packet scramjet

const lora_comms = require('lora-comms'); // this module will provide us with inbound and outbound streams
const lora_packet = require('lora-packet'); // this module will allow us to decrypt/decode the data
const {DataStream} = require('scramjet');

So now let's create a LoRa byte stream - there's a number of ways we could do that, but we'll simply use the stream provided by lora-comms:


const loRaPackets = BufferStream.from(lora_comms.downlink);

Our stream is a list of buffers consisting of different size packets that we need to separate from each other. We'll use an async generator to read the data:

const packets = DataStream.from(async function*() {
  const init =