Simple flour grinder monitor (wireless!)

We make our own bread here at my house, including grinding flour.
This makes for excellent bread, but the flour grinder needs to be checked often while it’s grinding. If it runs out of grain the stone starts working it’s way loose and eventually falls into the flour and causes issues.

Enter the Bobnova Grinder Monitoring System. I built it this afternoon half for usefulness and half because I had an idea and I enjoy making things.

The grinder end of things is a RBBB with a RF12B radio and a basic light sensor that is buried in the grain hopper.
When the grain gets down to ~2 minutes left, the light sensor surfaces and detects light.
It checks the light level every 200ms or so, and broadcasts that out into the world.
Eventually it’ll be able to turn the grinder off, as well as monitoring the grinder RPM in case the belt starts slipping. Right now, it just blasts the light level detected out into the world.
On the receiving end is another RBBB+RF12B combo, this one with a green LED and a very bright red LED (ripped it out of an optical mouse, nice LED!).

The green LED flashes every time a valid CRC-OK packet shows up, so you know that the two are still in communication.
Once the light level goes above a level I would describe as “very dim”, the bright red LED starts flashing. At this point the red LED continues flashing regardless of whether the light level stays bright or not. This’ll include a buzzer eventually.

The code is quite simple, the jeenode RF12 library makes the radio extremely easy to use.

Transmitter/sensor code:

#include <Ports.h>
#include <RF12.h>  //have to include Ports.h and RF12.h, RF12.h depends on Ports

struct {
  int light : 12;  //build-your-own data types make the radio *really* easy to use
  int alert : 2;
} sendData;

int light;

void setup(){
//  Serial.begin(57600);
  byte test = rf12_config();            // looks weird, but rf12_config can't be called by itself for some reason.

void loop(){
  light = 0;
  for(int x = 0 ; x < 10 ; x++){
    light = light + analogRead(5);   //  lots of reads with a brief delay helps a lot in getting rid of random noise
    delay(1);                                    //  like that caused by the chunky 120v 60hz motor driving the grinder
  light = light / 10;
  sendData.light = light;
  rf12_recvDone();                                                      // recvDone keeps the radio happy, it has to be called from time to time
  if (rf12_canSend() == 1){                                          //make sure we're allowed to send, can't send without checking first.
    rf12_sendStart(0, &sendData, sizeof sendData);  //blast the data off into the world, not aimed at a given radio nor asking for ACK

Receiver/alarm unit code:

#include <Ports.h>
#include <RF12.h>

typedef struct {
  int light : 12;
  int alert : 2;
} Payload;
Payload receivedData;

unsigned long lastReceived;
boolean ZOMG = false;

void setup(){
  byte initRF12 = rf12_config();

void loop(){
  if (rf12_recvDone() && rf12_crc == 0 && rf12_len == sizeof (Payload)){
    receivedData = *(Payload*) rf12_data;
    lastReceived = millis();
    if (receivedData.light > 150){
      ZOMG = true;
  if (ZOMG){

Just tested it out, and it works quite nicely.
Radios are great fun, and these RF12B modules only cost $7ish at moderndevice. Sparkfun has 'em as well.
I highly recommend them.

nice done …i will use your code,
i will modify your code … to send 6 analog inputs …to a receiver with 6 led’s
thank you again!!!