thingsinjars

  • 16 Sep 2023

    My Books

    Not Geek, Ideas

  • 16 Sep 2023

    Operations: A Maths Game

    Operations

    1+ players

    The aim is to get the highest number possible after using each of your tokens.

    There is 1 die

    Each player has 4 tokens with different symbols on:

    + − × ÷

    Each player rolls the die and the number they get is their starting number.

    Lowest score starts. If there's a draw, youngest of those starts.

    Each round:

    1. Roll the die
    2. Choose one of your operations.
    3. Perform your operation with the new number and your existing number. Try to get the highest score
    4. Discard your operation token. You only get to use each operation once.

    Note: When the calculation is a division with a remainder, you can either discard the remainder or continue with decimals, depending on who is playing.

    Example game:

    2 players.

    A rolls 2, B rolls 3. A has the lowest starting number so they start

    1. Round 1
      • A rolls a 4. They decide to use their + operation. They now have 6.
      • B rolls a 1. They use their ÷ . They still have 3.
    2. Round 2
      • A rolls 6. They use their × . They have 36.
      • B rolls 5. They use their × . B now has 15
    3. Round 3
      • A rolls another 6. They've already used their × so they have to either subtract 6 or divide by 6. They use − . They have 30
      • B rolls 2. They + it. B has 17
    4. Round 4
      • A rolls another 6! Now they only have their ÷ left. They have to divide 30 by 6. Now they have 5.
      • B rolls 3. They have their − left. B has 14.

    B wins.

    Variations

    • For advanced maths, add in the power and root symbols ^ √
    • Try to get the lowest score instead of the highest.
    • Try to get the lowest score without going below zero.

    Geek, Toys, Ideas

  • 17 Jun 2023

    Pi-ku

    A what? A pi-ku?

    To quote Maths Week Scotland:

    A pi-ku is a poem that follows the form of a haiku, but instead of the 5-7-5 haiku pattern, the syllables in a pi-ku follow the number of digits in the mathematical constant pi (π).

    So, instead of 5-7-5, a pi-ku would follow the pattern 3-1-4 (-1-5-9-2…etc.)

    Of course, I couldn't avoid having a go myself, could I?


    Approximation of Pi

    Pi is three
    Well...
    Three and a bit.
    …ish.
    The 'bit' is quite small.


    Full-time Score of the Final of the World Circle Geometry Ratio Tournament 2023

    Radius:
    2
    Diameter:
    1


    Subjectively Reviewing areas of Mathematics

    Algebra?
    Fine.
    Geometry?
    Fun.
    Trigonometry?
    Partial Differential Equations?
    Both Good.
    Fractal Geometry?
    Looks simple at first.
    Gets... tricky
    When you look closer.


    Marginal

    Fermat's Last?
    Gasp!
    I Found a Proof!
    Which,
    Unfortunately...
    This poem is too short to contain.

    Geek

  • 31 Dec 2021

    RFID Timesheet

    I've done a lot of projects over the holidays. This is a quick collection of notes to remind myself later.

    I used an RC522 RFID scanner (originally part of a Tonuino project) and wired it to a Particle Photon. Whenever an RFID tag was held to it, it would publish an event containing the ID of the card to the Particle Cloud. When the card was removed, it would publish a blank event. This is the code from the Photon:

    // Photon   RFID-RC522
    //   A2         SDA
    //   A3         SCK
    //   A4         MISO
    //   A5         MOSI
    //   D2         RST
    //   GND        GND
    //   3V3        3.3V
    
    #include 
    #include 
    
    #define LED_PIN     D7
    
    constexpr uint8_t RST_PIN = D2;          // Configurable, see typical pin layout above
    constexpr uint8_t SS_PIN =  A2;           // Configurable, see typical pin layout above
    
    MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance
    
    uint32_t lastMillis = 0;
    bool wasPresent = false;
    
    void setup() {
        pinMode(LED_PIN, OUTPUT);
    	Serial.begin(9600);		// Initialize serial communications with the PC
    	while (!Serial);		// Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
    	SPI.begin();			// Init SPI bus
    	mfrc522.PCD_Init();		// Init MFRC522
    	mfrc522.PCD_DumpVersionToSerial();	// Show details of PCD - MFRC522 Card Reader details
    	Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks..."));
    }
    
    void loop() {
    	// Look for new cards
    	if ( ! mfrc522.PICC_IsNewCardPresent()) {
    	    if(wasPresent) {
    	        if(! mfrc522.PICC_IsNewCardPresent()) {
    	          Serial.println("No card");
    	          Particle.publish("rfid_scan", "", 60, PRIVATE);
    	          wasPresent = false;
    	        }
    	    } else {
    	        
    	    }
    		return;
    	}
    
    	// Select one of the cards
    	if ( ! mfrc522.PICC_ReadCardSerial()) {
    		return;
    	}
    
        char cardID[32] = "";
    
        for (byte i = 0; i < mfrc522.uid.size; i++) {
         char hex[4];
         snprintf(hex, sizeof(hex), "%02x", mfrc522.uid.uidByte[i]);
         strncat(cardID, hex, sizeof(cardID));
        }
    
        if (millis() - lastMillis < 1000) {
            return;
        }
        lastMillis = millis();
    
    	if(!wasPresent) {
    	    wasPresent = true;
    	    Particle.publish("rfid_scan", cardID, 60, PRIVATE);
    	    Serial.printlnf("Card: %s", cardID);
    
    	    // Turn on the LED
    	    digitalWrite(LED_PIN, HIGH);
    
    	    // Leave it on for one second
    	    delay(1s);
    
    	    // Turn it off
    	    digitalWrite(LED_PIN, LOW);
    
    	    // Wait one more second
    	    delay(1s);
    	}
    
    	// Dump debug info about the card; PICC_HaltA() is automatically called
    	//mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
    }

    I then used IFTTT to read these events and write them to a Google Spreadsheet. This is the IFTTT Excel code:

    {{CreatedAt}} |||{{EventContents}}||| =IF(ISODD(ROW()), "Started", "Stopped") ||| =IF(ISEVEN(ROW()),ROUND(((DATEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW(),COLUMN()-3,4)), "w+ d{2}, d{4}")) + TIMEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW(),COLUMN()-3,4)), "d{2}:d{2}[A|P]M$"))) - ( DATEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW()-1,COLUMN()-3,4)), "w+ d{2}, d{4}")) + TIMEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW()-1,COLUMN()-3,4)), "d{2}:d{2}[A|P]M$")))) * 24, 2),"")|||
    =IFERROR(VLOOKUP(INDIRECT(ADDRESS(ROW(), COLUMN()-3),4), I$3:J$10, 2, FALSE), "")

    We now have a physical time tracker that can be used to log time spent on individual projects. Super-handy for Jenni's freelance work.

    Geek

  • 31 Dec 2021

    IoT Button

    I've done a lot of projects over the holidays. This is a quick collection of notes to remind myself later.

    I took the insides out of an old IKEA Spøka nightlight and squeezed in a Particle Photon, a battery shield and a battery then soldered the nightlight's on/off switch onto some jumper cables and wired that in. I now have an internet-connected button that looks cute.

    Still no idea what to do with it but it’s fun.

    Here's the code that's running on the Photon:

    int led = D7; // Built-in LED
    int pushButton = D6; // Old Spøka momentary switch

    bool wasUp = true;

    void setup() { pinMode(led, OUTPUT); pinMode(pushButton, INPUT_PULLUP); }

    void loop() { int pushButtonState;

    pushButtonState = digitalRead(pushButton);

    if(pushButtonState == LOW) { // If we push down on the push button digitalWrite(led, HIGH); // Turn ON the LED if(wasUp) { Particle.publish("Spooky pressed"); wasUp = false; } } else { digitalWrite(led, LOW); // Turn OFF the LED wasUp = true; }

    }

    When you press the button, you get a message published to the Particle Cloud.

    Geek

  • newer posts
  • older posts

Categories

Toys, Guides, Opinion, Geek, Non-geek, Development, Design, CSS, JS, Open-source Ideas, Cartoons, Photos

Shop

Colourful clothes for colourful kids

I'm currently reading

Projects

  • Awsm Street – Kid's clothing
  • Stickture
  • Explanating
  • Open Source Snacks
  • My life in sans-serif
  • My life in monospace
Simon Madine (thingsinjars)

@thingsinjars.com

Hi, I’m Simon Madine and I make music, write books and code.

I’m the Engineering Lead for komment.

© 2025 Simon Madine