Is it valid to use an ASK RF 433 MHz radio receiver for random seeding?

Hello,

I did some tests and had satisfactory results,

06:07:55.480 -> random: 67
06:08:03.250 -> random: 44
06:08:09.750 -> random: 82
06:08:15.777 -> random: 67
06:08:21.647 -> random: 97
06:08:27.750 -> random: 67
06:08:35.715 -> random: 35

Is there any limitation in the seed function?

Hardware:

Software:

/*
   Seed generator for random function using generic hardware.

   The RF 433 receiver captures any noise in its reception range,
   We can use these pulses to generate a random number.

   by Rtek1000 (06-jun-2022)

   Hardware:
   1- RF 433 recetor
   1- Analog input
   1- Resistor 10k (between receiver output and analog input)

*/

#define no_hardware_test 1 // Uncomment to test: Read input and seed in random
#define adc_test 1 // Uncomment to test: Show process data

#ifdef adc_test
byte buff[10]; // Used for sampling only, can rule out
#endif

void setup() {
  // put your setup code here, to run once:
  delay(300);

  Serial.begin(115200);

  Serial.println("Start");

#ifndef no_hardware_test

  pinMode(A7, INPUT);

  uint32_t val_sum = 0;
  uint32_t val_time1 = 0;
  uint32_t val_time2 = 0;
  uint32_t timeout = 0;

  for (int i = 0; i < 10; i++) {
    val_time1 = micros();

    timeout = 0;

    while ((analogRead(A7) > 512) || (timeout < 1000)) {
      delayMicroseconds(1);

      timeout++;
    }

    timeout = 0;
    
    while ((analogRead(A7) < 512) || (timeout < 1000)) {
      delayMicroseconds(1);

      timeout++;
    }

    val_time2 = micros() - val_time1;

    val_sum += val_time2;

#ifdef adc_test
    buff[i] = val_time2 & 0xFF;
#endif
  }

  val_sum /= 10;

#ifdef adc_test
  for (int i = 0; i < 10; i++) {
    Serial.print("buff(");
    Serial.print(i, DEC);
    Serial.print("): ");
    Serial.println(buff[i]);

    delay(5);
  }
#endif

  randomSeed(val_sum);

  Serial.print("val_sum: ");
  Serial.println(val_sum);
#endif

  Serial.print("random: ");
  Serial.println(random(0, 100));
}

void loop() {
  // put your main code here, to run repeatedly:

}

Ref.: GitHub - rtek1000/Hardware_Random_Number_Generator_ASK: Seed generator for random function using generic RF 433 receiver (ASK)

Isn't this a bit of overkill?
Anything producing noise can be used as random seed...

It is limited to producing a start point of a relatively short pseudorandom sequence.

What are your requirements?

The truth is there is very little "noise" at 433 mHz. What is happening is the noise generated by the IC, itself. Certainly no received noise will get through the processing of the IC. Any diode could be used for the same thing. I have a noise generator, built many years ago that does exactly that,

True. Is this the superregenerative version of the receiver?

If it actually receives a signal, the random "noise" will of course cease. :face_with_raised_eyebrow:

This receiver has no LC tank circuit. This one works with a quartz crystal. Mine is similar to this one:

rf433-92mhz-xtal

The RFRM4302-RXN3S is a miniature receiver module that receives On-off keyed (OOK) modulation signal and demodulated to digital signal for the next decoder stage. Local oscillator is made of PLL structure. The result is excellent performance in a simple to use,
with a very low external component count.

Source: https://manualzz.com/doc/30833578/rfrm4302-rxn3s-rf-receiver-module-ask--ook---315-433.92mhz

About the diode, yes, I saw that there are circuits that use only one junction of a bipolar transistor (as if it were just a diode).

But I already had the RF 433 receiver being used for remote control. It's probably the circuit itself that causes the noise, really,

However, I don't believe it's feasible to leave the receiver on and the microcontroller off, so maybe the noise always occurs. :sweat_smile:

But the data slicer of those cheap receivers constantly switches between logic levels.
Put a scope on it and you will see.
Leo..

But what little noise there is, gets amplified a lot by the receiver and combined with the noise in the receive preamplifier semiconductors.

I like the idea, the modules are super cheap.

1 Like

The noise CREATED by the receiver is SO much greater than the noise from the antenna. Take the antenna off and see if you still have the noise.

Then you have a cheap noise generator, it's what the OP wants. How much RF noise, well of course it depends on what RF sources are around, on the frequency of interest. I recently noticed, I can point an antenna skyward and hear sky noise, point at the ground and it goes away. 1296MHz.

Some bands are a lot dirtier than others, I'm sure you know. Sample around 150MHz in any urban environment, it's insane.

Actually, to use it for randomness it would be better to not receive RF because the signals are not random. For example, when a wireless thermometer or such transmits, it sends a long string of regular training pulses that would be cleanly demodulated and put the kybosh on any concept of randomness. Edit - just noticed this was already mentioned in reply #5.

1 Like

If the OP would Google for "diode noise generator" they would find a much cheaper and easier to implement device.

I'm not sure if it would always be cheaper. Consider the cost even of the proto board that you would build it on. The complete receiver is about the same price as that. It also has the analog to digital conversion on board - the "data slicer" mentioned above.

Also, in this case it's free, since the OP says " I already had the RF 433 receiver". Should probably terminate the input though, instead of attaching an antenna or leaving it open.

1 Like

Why?

To exclude signals that might be deterministic, as you suggested might be present, in a previous post.

1 Like

"Sky noise" nice!

It's noise from the "big bang". Some little bit from the Sun and Jupiter.

1 Like

Yes, I already knew about the origin of the noise, I liked this frequency value.

I watched about 30 videos on basic astro physics.

It's interesting to know about where we are in the universe.

And it seems to me that the stars use speed control similar to a PID type control hehehe :sweat_smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.