A Simple display for ArduSiPM
OLED Display 128 x 64 Pixel 0,96 pollice I2C
ArduSIPM connected to Wemos D1 Mini (ESP8266) driving the OLED Display
The counts are too high...Simple there are some pieces of uranium glass over the detector.
Connection between ArduSiPM D1 Mini (ESP8266) OLED Display (128x64)
Simple Source code for ESP8266 Board (example wemos D1 Mini)
// ESP8266 ArduSiPM mini OLED Display
//Program using ESP8266 board and OLED ssd1306 I2c to dispay ArduSiPM data rate.
//Author:valerio.bocci@roma1.infn.it
// August 2018.
// Simple program
// Using OLED ssd1306 128x64 as ArduSiPM Data Display
//
// DATA DISPLAY
// Count (instantaneous count from ArduSiPM acquisition window)
// counts/sec (counts accumulated in a 60 Sec window)
// CPM (Count per minute of the previous 60 seconds window)
// Rate (rate in Hz of the previous 60 seconds window)
//
//
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
//https://github.com/ThingPulse/esp8266-oled-ssd1306
// you can found this library in Arduino library manager using the following resarch key: ESP32 ESP8266 OLED
#include "SSD1306.h" //
#include "images.h"
//SSD1306 Connection to D1 mini
// VDD -> 3.3 V o 5 volt
// GND -> G
// SCK -> D1
// SDA -> D2
//display(ADDRESS, SDA, SDC);
SSD1306 display(0x3c, D2, D1);
// Stringhe
char character;
String Line,countstring;
int linenr,seconds,counts,CPM;
// remember:
// Println send data to the serial port as human-readable ASCII text
//followed by a
//carriage return character (ASCII 13, or '\r')
// and
// a newline character (ASCII 10, or '\n')
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println();
// Initialising the UI will init the display too.
display.init();
display.flipScreenVertically();
///----------------FONTs--------------------------
// Sets the current font. Available default fonts
// ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24
// Or create one with the font tool at http://oleddisplay.squix.ch
display.setFont(ArialMT_Plain_10);
// clear the display
display.clear();
display.drawString(0, 0, " waiting ArduSiPM data");
display.drawString(0, 11," PLEASE CONNECT ");
display.drawString(0, 21," RX (ESP8266) ");
display.drawString(0, 31," to TX (ArduSiPM)");
display.drawString(0, 41," Author:");
display.drawString(0, 51,"valerio.bocci@roma1.infn.it");
display.display();
}
void loop() {
if (Serial.available()) {
character=Serial.read();
switch (character)
{
case '$':
Line="";
character=' ';
break;
case '\r':
character='\r';
break;
case '\n':
character='\n';
seconds=seconds+1;
counts=counts+Line.toInt();//number of counts in
countstring=String(counts);
display.clear();
Line="ArduSiPM Data (V.Bocci):\r\nCounts:"+Line+"\r\ncounts:"+String(counts)+"/"+String(seconds)+" Sec"+"\r\nCPM:"+String(CPM)+"\r\nRate:"+String(CPM/60.)+"Hz";
display.drawString(0, 0, Line);
display.display();
linenr=linenr+1;
if (linenr>0)
{
Line="";
linenr=0;
}
if (seconds==60)
{
seconds=0;
CPM=counts;
counts=0;
}
break;
case '-':
Line="";
break;
}
Line=Line+character;
}
}