{"id":43145720,"url":"https://github.com/gbonacini/nuclear_rng_generation3","last_synced_at":"2026-01-31T23:44:20.083Z","repository":{"id":216591497,"uuid":"739596298","full_name":"gbonacini/nuclear_rng_generation3","owner":"gbonacini","description":"\"Geigerless\" Nuclear Random Number Generator","archived":false,"fork":false,"pushed_at":"2024-01-13T21:29:32.000Z","size":35829,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-05T10:27:45.809Z","etag":null,"topics":["bg51","cpp","nuclear","radiation","random-number-generators","raspberry-pi-pico","rng"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gbonacini.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2024-01-06T00:42:22.000Z","updated_at":"2024-01-12T20:28:51.000Z","dependencies_parsed_at":"2024-01-11T05:14:06.076Z","dependency_job_id":null,"html_url":"https://github.com/gbonacini/nuclear_rng_generation3","commit_stats":null,"previous_names":["gbonacini/nuclear_rng_generation3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gbonacini/nuclear_rng_generation3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbonacini%2Fnuclear_rng_generation3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbonacini%2Fnuclear_rng_generation3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbonacini%2Fnuclear_rng_generation3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbonacini%2Fnuclear_rng_generation3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbonacini","download_url":"https://codeload.github.com/gbonacini/nuclear_rng_generation3/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbonacini%2Fnuclear_rng_generation3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28960965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T23:03:11.038Z","status":"ssl_error","status_checked_at":"2026-01-31T22:56:44.691Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bg51","cpp","nuclear","radiation","random-number-generators","raspberry-pi-pico","rng"],"created_at":"2026-01-31T23:44:19.356Z","updated_at":"2026-01-31T23:44:20.070Z","avatar_url":"https://github.com/gbonacini.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction:\n=============\n\nThis project is the third variation of the theme \"creation of RNG generators based on nuclear decay\",  you can find the other two implementations here:\n\n[NuclearRNG Version 1](https://github.com/gbonacini/nuclear_random_number_generator)\u003cBR\u003e\n[NuclearRNG Version 2](https://github.com/gbonacini/nuclear_rng_generation2)\n\nThis version, differently from the previous two, does not use a Geiger–Müller tube nor a classic Geiger counter but an array of PIN diodes produced by Teviso company, named BG51:\n \n[BG51 Datasheet](https://www.teviso.com/file/pdf/bg51-data-specification.pdf)\n\nUsing that component, the implementation of the present appliance is greatly simplified, avoiding all the high voltage circuitry necessary to operate a Geiger tube. Furthermore, the small dimensions of the component permits to implement a very compact device.\n\n![alt text](./screenshots/appliance.jpg \"Appliance\")\n\nHardware:\n=========\n\n* A Raspberry Pico (RP2040) is employed as microcontroller platform;\n* A BG51 radiation sensor;\n* Some circuitry to filter the power source and to convert the logic level of the sensor output.\n\nHardware Details:\n=================\n\n* As radiation source, a piece of ceramic coated with uranium oxide is employed. It comes from a salt / pepper dispenser I purchased set from the 50s, unfortunately one was damaged, the handle was broken and that peace is now temporarily the source of this appliance:\n![alt text](./screenshots/source_1.jpg \"Source\")\n![alt text](./screenshots/source_2.jpg \"Source 2\")\n\n* A lead metallic shield contains both a radiation source and the sensor, fixed with non-permanent glue. The shielding has two functions, prevent radiation to reach the external environment and prevent external interferences, both particles (particle injection attack ? :-) ) and electromagnetic. In fact the product, as stated in datasheets, requires some kind of shielding:\n![alt text](./screenshots/chamber_1.jpg \"Chamber\")\n![alt text](./screenshots/chamber_2.jpg \"Chamber 2\")\n![alt text](./screenshots/assembly_1.jpg \"Chamber 2\")\n\n* A circuit to stabilize input voltage is required, I tested also with boards different from Pico having the same results: being the sensor sensible to rumor in the power supply, a filter is mandatory. Testing without filtering in power input, produced distortions in the output.  I implemented a filter using the specifications in Teviso's manuals and all problems disappeared.\n\n*  Datasheet tell us that at least 4V are required, so I opted for 5V and a small logic level converter to interface the sensor to Pico's 3V logic. This operation could be made with many different solution, I used my own.\n![alt text](./screenshots/sensor.jpg \"Test\")\n![alt text](./screenshots/bboard.jpg \"Circuit\")\n\n\nAlgorithm and Features:\n=======================\n\n* In loop, a register with a representation od an unsigned integer is cyclically increased from 0 to its maximum value, when it reaches the maximum it restarts from zero. When a particle is detected, the current value is stored in queue ready to be deployed on request;\n* Default queue length is 10240 bytes.\n\nProtocol:\n=========\n\n* When a socket connects to the appliance via WIFI, a message with the following format is given as response:\n```shell\nready\\n\n```\n\u003csp\u003e\u003csp\u003e\u003csp\u003ewhere '\\n' is \"newline\" character\n* You require a RN sending the message:\n```shell\nreq\n```\n* Then you'll receive a RN in an answer with the following format:\n```shell\n\u003crandom_number\u003e\u003cseparator\u003e\u003cgenerator_number\u003e\u003cseparator\u003e\u003cavailable_numbers\u003e\u003cnewline\u003e\n```\n\u003csp\u003e\u003csp\u003e\u003csp\u003ewhere:\n  - the first field is a random number in the range 0-15 or the number 16 if an error was generated or no number is available yet;\n  - the second field represent the original value of the register incremented in loop to extract the random number using module operator of integer division by the specific range (0-255, 8-bit integers), it's provided as safeguard to verify that the loop cover every possible value for a given event frequency; \n  - the separator is the character ':';\n  - then a field with an integer telling you how many RNs are available in the appliance buffer, ready to be requested;\n  - a newline ( '\\n' ) ends the message.\n* Example:\n```shell\n52:3473460:1384\\n\n```\n\n* You can terminate the connection with the command:\n```shell\nend\n```\n* At the moment, concurrent access is not supported (aka I don't need it for now), so, closing the connection also permits different client to connect;\n\nDependencies:\n=============\n\n* Raspberry Pi Pico SDK\n* Cmake\n\nDetailed instruction for dependencies installation are available on Raspberry website.\n\nConfiguration:\n==============\n\n* Before compiling, is required to edit wifi_credential.hpp inserting Wifi SSID and password.\n\nInstallation and Use:\n=====================\n\n- compile the program as follow (set -DPICO_SDK_PATH using real pico-sdk path):\n```shell\n  cd build\n  make -f makefile.srv all\n```\n- deploy the generated binary file named:\n```shell\ngeiger_gen3.uf2 \n```\n  putting the Pico in \"deploy mode\" pushing the white button before connecting USB cable and releasing the same button a second after the connection.\n- A trivial Python client example is present in \"test\" directory in the present software distribution.\n- The number can be requested from any program able to create Berkeley sockets using the described protocol.\n\nCredits:\n========\n\n- Thanks to Teviso company (https://www.teviso.com) that kindly provided the sensor for this project;\n- Thanks to my friend Andrea ( https://github.com/btlgs2000 ) for his help to test this applicance.\n\n\nComing soon:\n============\n\n- test and statistics\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbonacini%2Fnuclear_rng_generation3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbonacini%2Fnuclear_rng_generation3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbonacini%2Fnuclear_rng_generation3/lists"}