Create Project Need help?
Show more (3)

USB Random-Number Generator

Status: Proposal
May 4, 2019
In the Elektor magazine 3/4-2017 Luka Matic published his random number generator based on cheap components ( This variant of his work replaces the memory card slot and comes with a USB interface. It has two PIC controllers one for the analog sampling (PIC16) and one for the USB (PIC18). Both are linked via SPI and high speed opto couplers so that noise from the USB does not disturb the analog signal.

Attached are the schematics (3 pages), the project file from Target, firmware for the PIC16 (analog sampling, MPLAB X IDE with PCM C compiler from ccsinfo), for the PIC18 (USB handling, MPLAB X IDE with XC8) and the desktop application (C#, Visual Studio 2017 commmunity edition). The PC application allows for easy calibrating the analog filters in realtime.

My filter settings for the analog filters are as follows:
S5: C37, C38, C39, C40, C41 ON with C39 at 109 pF
S6: C45, C46, C47 ON with C47 at 25 pF
S7: Switch1 ON and P6 at 409 ohm

Please note that you may need different settings dependent on the components you use to build the board. It is also important what type of zeners you use. I first used a BZX384C12-E3-08  from Vishay but its noise was bad.

Please note also that compared to the original work from Luka the PIC16 has a slightly higher sampling rate (800 kHz, 1.25 us per sample).
Read the full post
Show less
Screenshot of the PC desktop application for calibrating the analog filters and recording random data

Loading comments...