Saturday, November 21, 2020

0000 0000 0100 1010

PCF8563 Time/Date IC

Slightly obsessed with timing devices (really?!), I saw these PCF8563 real time clock chips that had so many features and looked too good to be true (and so cheap!). I grabbed some that were already made up in modules, and others that are just raw IC chips ready to be used in an appropriate circuit.

In this blog I am going to focus on the raw IC version and try to get it going so that I can measure and store time.

The first order of business is to solder up the SOP8 package onto a DIP8 adapter. I put some extra white paint on the little fella so that I know it's not an AVR or PADAUK when I reach for it!


The plan is to put this on a breadboard and then:

  1. program an Arduino Nano to push out the time/date to the RTC
  2. everything sleeps in low current mode
  3. pushing a button wakes up the Nano
  4. the Nano polls the RTC for time and date (and turns on an LED for good measure, also who doesn't like a blinking LED?)
  5. the Nano pushes out the time/date to an OLED display for a few seconds
  6. everyone goes back to sleep
  7. battery backup the whole shebang with a coin cell battery?
  8. swap out the Nano for an ATMega328 to further reduce the current requirements?

I am more than a little unhappy with the internet over this little circuit, for a couple of reasons. Firstly when I looked for a likely setup, I came across this site with the following picture.


Even though from previous experience with crystals I knew that capacitors need to be used to get the things oscillating, the only capacitor mentioned on the page is for decoupling and it's not near the crystal.

Upshot? I spent a "happy" couple of hours trying to debug code that clearly showed the Nano talking to the RTC, and vice versa, but the RTC not "ticking" in any clock-like manner. This problem was eventually solved with the addition of a 20pf capacitor between the crystal and ground. Do I need to put one on the other side? I'm not sure! At this point I was just happy to see the little fella measuring the <frustrating long> passage of time.


Secondly there were a LOT of libraries purporting to help communicate with the PCF8563. Sadly many had holes and it took quite a bit of fiddling to realise that this library is the easiest and most functional. It's found and installed very quickly using the Arduino IDE "Library Manager" dialog.

I also realised that for my sanity to prevail I would work with two lots of (very similar) code, one to set the RTC and one to then read it on demand. I have seen these combined on some sites with similar software via a "flag" or test, but it seemed just as easy to separate out these similar but fundamentally different functions, even though much of the rest of the code is the same.

I've highlighted the essential difference.

Setting Code:

/*
   Using an PCF8563 as an RTC for an Arduino Nano
   and an OLED display

   One Circuit Friday 13 November 22:26:09 AEDT 2020
   Friday 13th! Yikes!
*/

#include <Wire.h>
#include "RTClib.h"
#include <avr/sleep.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// some variables and constants
byte thehour = 0;
byte theminute = 0;
byte thesecond = 0;
byte theday = 0;
byte themonth = 0;
int theyear = 0;
String myminute = "minute";
String mysecond = "second";
const byte ledPin = 4;
const byte interruptPin = 2;
volatile boolean button = false;

#define OLED_RESET -1
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32

// initialise our I2C devices
RTC_PCF8563 rtc;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// button ISR
void wakeUpNow() {
  button = true;
}

// sleep routine
void sleepNow() {
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);  
  sleep_enable();         
  sleep_mode(); 
  sleep_disable(); 
  detachInterrupt(0);
}

void setup () {
  while (! rtc.begin()) {
    delay(500);
  }
  delay(1000); // settle rtc
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), wakeUpNow, RISING);
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64
    for (;;);
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 0);
  display.println("OneCircuit Clock");
  display.display();
  delay(3000);
  display.clearDisplay();
  display.display();
}

void showtime() {
  digitalWrite(ledPin, HIGH);
  DateTime now = rtc.now();
  thehour = now.hour();
  theminute = now.minute();
  // make it pretty if the numbers are below 10
  if (theminute < 10) {
    myminute = "0" + String(theminute);
  }
  else {
    myminute = String(theminute);
  }
  thesecond = now.second();
  if (thesecond < 10) {
    mysecond = "0" + String(thesecond);
  }
  else {
    mysecond = String(thesecond);
  }
  theday = now.day();
  themonth = now.month();
  theyear = now.year();
  // string together the date/time (pun intended)
  String nowtime = "TIME " + String(thehour) + ":" + myminute + ":" + mysecond;
  String nowdate = "DATE " + String(theday) + "/" + String(themonth) + "/" + String(theyear);
  display.setCursor(10, 0);
  display.println("OneCircuit Clock");
  display.setCursor(10, 15);
  display.println(nowtime);
  display.setCursor(10, 25);
  display.println(nowdate);
  display.display();
  delay(5000);
  digitalWrite(ledPin, LOW);
  display.clearDisplay();
  display.display();
  button = false;
  attachInterrupt(digitalPinToInterrupt(interruptPin), wakeUpNow, RISING);
}

void loop() {
  if (button) {
    showtime();
  }
  sleepNow();
}

Reading Code:

/*
   Using an PCF8563 as an RTC for an Arduino Nano
   and an OLED display

   One Circuit Friday 13 November 22:26:09 AEDT 2020
   Uh Oh - Friday 13th...
*/

#include "RTClib.h"
#include <avr/sleep.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// some variables and constants
byte thehour = 0;
byte theminute = 0;
byte thesecond = 0;
byte theday = 0;
byte themonth = 0;
int theyear = 0;
String myminute = "minute";
String mysecond = "second";
const byte ledPin = 4;
const byte interruptPin = 2;
volatile boolean button = false;
#define OLED_RESET -1
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32

// initialise our I2C devices
RTC_PCF8563 rtc;
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// button ISR
void wakeUpNow() {
  button = true;
}

// sleep routine
void sleepNow() {
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sleep_mode();
  sleep_disable();
  detachInterrupt(0);
}

void setup () {
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  while (! rtc.begin()) {
    delay(500);
  }
  delay(1000); // settle rtc
  attachInterrupt(digitalPinToInterrupt(interruptPin), wakeUpNow, RISING);
  DateTime now = rtc.now();
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    for (;;);
  }
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 0);
  display.println("OneCircuit Clock");
  display.display();
  delay(3000);
  display.clearDisplay();
  display.display();
}

void showtime() {

  digitalWrite(ledPin, HIGH);
  DateTime now = rtc.now();
  thehour = now.hour();
  theminute = now.minute();
  // make it pretty if the numbers are below 10
  if (theminute < 10) {
    myminute = "0" + String(theminute);
  }
  else {
    myminute = String(theminute);
  }
  thesecond = now.second();
  if (thesecond < 10) {
    mysecond = "0" + String(thesecond);
  }
  else {
    mysecond = String(thesecond);
  }
  theday = now.day();
  themonth = now.month();
  theyear = now.year();
  // string together the date/time (pun intended)
  String nowtime = "TIME " + String(thehour) + ":" + myminute + ":" + mysecond;
  String nowdate = "DATE " + String(theday) + "/" + String(themonth) + "/" + String(theyear);
  display.setCursor(10, 0);
  display.println("OneCircuit Clock");
  display.setCursor(10, 15);
  display.println(nowtime);
  display.setCursor(10, 25);
  display.println(nowdate);
  display.display();
  delay(5000);
  digitalWrite(ledPin, LOW);
  display.clearDisplay();
  display.display();
  button = false;
  attachInterrupt(digitalPinToInterrupt(interruptPin), wakeUpNow, RISING);
}

void loop() {
  if (button) {
    showtime();
  }
  sleepNow();
}

After all of this fiddling about I was able to breadboard the devices together and make the clock a reality.


The battery backup proved useful for kicking out the programming USB cable as the power supply and running the device independently via a battery bank, with a coin cell battery stuck in to keep the clock ticking.

For backup power to work properly I needed to put in a diode (1N4148 in my case) from the 5V to the IC and another one from the battery (3.3V) to the IC. I'm pretty sure a Schottky would be fine as well for this job. The diodes prevent the backup from trying to run the whole circuit when the power is out, and also to prevent the 5V from the main battery/power source from interfering with the coin cell.

Just for "fun" and as seen in the picture above, I also compiled the code for the ATMega328 which worked fine - nice one!





Saturday, November 14, 2020

0000 0000 0100 1001

MT3608 voltage regulator

A happy coincidence was the arrival of a heap of MT3608 chips in different circumstances. Firstly I had re-ordered the ubiquitous voltage regulator modules, not realising at the time that the ICs at their heart also form a part of the "Pesky Padauk Programmer Project"™ (parts one, two and three).

And so a bunch of raw chips showed up as well, some of them acquired just to see if and how to I could make a DC-DC boost converter. I have blown up a few of these ready-made modules in my time, and I'm not the only one!

My goal for this IC was to first make a successful 15V boost converter from a low voltage source, and then to see if I could maybe vary the output voltage by using a pot connected to the IC itself, and then maybe by using a PWM signal (?) feeding into the IC. 

From the datasheet comes:


The freepdk programmer uses 240k as R1 and 10k as R2 and so the voltage should be 0.6x(1+240/10)=15V. 


The tiny little fella looks great shackled onto an adapter built for an entirely different chip!


The FreePDK Padauk Programmer also uses some other components to maybe output different voltages programmatically via PWM?


The BSS84 is a PNP Mosfet (-0.13 A, -50 V) and the BSS138 (0.22 A, 50 V) is an NPN Mosfet and in this configuration with control coming from the STM32 I can only assume it turns on and off the 15V, but I was curious to see if it could also limit or control the voltage through some sort of PWM. 

The circuit diagram indicates some sort of Frankenstein Mosfet Sziklai pair, but I wasn't able to find any definitive information on this type of circuit, and my own experiments remain inconclusive, at this stage.





Saturday, November 7, 2020

0000 0000 0100 1000

"Blinky" the Ice Blue Solar Light

Putting the Stable Joule Thief (SJT) into service, in this post I am cutting the guts out of a standard solar garden light and making an ice blue blinking version. I'm not sure why.

Firstly the SJT itself which is a variation on the QX5252 IC circuit which looks like:


Using this circuit I've made up a few PCBs that allow a slow running ATTiny13a (at 128kHz) to be programmed. This one sleeps incessantly and just wakes up and blinks an LED from time to time (0.125s on, 2s off).

Here's the PCB version I'm using for this project.


Needing some code to sleep and blink the microcontroller, I dug out an old assembly project and modified it as follows:

.nolist
.include "tn13adef.inc" ; Define device ATtiny13A
.list
; **********************************
;        H A R D W A R E
; **********************************

; Device: ATtiny13A, Package: 8 - pin - PDIP_SOIC
;
;           ____________
;        1 /            | 8
;      o-- | RESET  VCC | --o
;      o-- | PB3    PB2 | --o
;      o-- | PB4    PB1 | --o
;      o-- | GND    PB0 | --o
;        4 |____________| 5
;

; **********************************
;         C O D E
; **********************************

    .cseg
    .org 000000

; **********************************
; R E S E T  &  I N T - V E C T O R S
; **********************************
    rjmp Main               ; Reset vector
    reti ; INT0
    reti ; PCI0
    reti ; OVF0
    reti ; ERDY
    reti ; ACI
    reti ; OC0A
    reti ; OC0B
    rjmp mytimer_ISR        ; my interrupt
    reti ; ADCC

; **********************************
;  I N T - S E R V I C E   R O U T .
; **********************************

mytimer_ISR:

    ;  sleep is interrupted, program returns
    reti

; **********************************
;  M A I N   P R O G R A M   I N I T
; **********************************
;
Main:
    ldi r16, Low(RAMEND)
    out SPL, r16              ; Init LSB stack pointer

    ; output mode for PB4, input for the rest
    ldi r16, 0b00010000
    out DDRB, r16

    ; turn on PB4, enable internal pullups
    ; on the rest of the pins
    ldi r16, 0b11111111
    out PORTB, r16

; **********************************
;    P R O G R A M   L O O P
; **********************************

Loop:

    rcall waitabit            ; 1/8 second (on)
    rcall waitalot            ; 2 seconds (off)

    rjmp loop

waitabit:

    ; reset watchdog timer
    wdr

    ; 1/8 second timer
    ldi r16, 0b01000011       ; see datasheet
    out WDTCR, r16

    rcall sleepnow
    rcall flipbit
    ret

waitalot:

    ; reset watchdog timer
    wdr

    ; 2 second timer
    ldi r16, 0b01000111      ; see datasheet
    out WDTCR, r16

    rcall sleepnow

    ; finished long sleep, so flip LED
    rcall flipbit

    ret


sleepnow:

    ; see datasheet MCUCR, ADCSRA, BODCR

    ; sleep enable, power down mode
    ldi r16, 0b00110000
    out MCUCR, r16

    ; disable ADC
    ldi r16, 0b00010000
    out ADCSRA, r16

    ; disable interrupts to make sure the following
    ; timed sequence is not interrupted
    cli

    ; disable BOD - must be done in a timed sequence
    ; as follows, write 1 to BODS and BODSE then within
    ; four clock cycles write 1 to BODS and 0 to BODSE
    ; then within three clock cycles enable sleep
    ; page 33 on the datasheet

    ldi r16, 0b00000011
    ldi r17, 0b00000010
    out BODCR, r16
    out BODCR, r17

    sei

    sleep

    ; sleep disable
    ldi r16, 0b00000000
    out MCUCR, r16

    ret

flipbit:
    ; if PB4 is on, switch off and vice versa

    in r16, portb
    ldi r17, 0b00010000
    eor r16, r17
    out portb, r16

ret

; End of source code

I burned the fuses, compiled the code and uploaded the hex file to the ATTiny13a (see video below). After testing, I was ready to assemble the PCB back into the gutted solar light and flick it out to the garden - nice!

Now we wait for alien overlords to see the signal and come on down for a nice cup of tea and to say hello.






Saturday, October 31, 2020

0000 0000 0100 0111

Making an old man programmer

Since the dawn of the "Pesky Padauk Programmer Project"™ (part one and part two) I have been wanting to make a version that suits my old man eyes, plus I thought it might be an opportunity to learn a bit about how this circuit (and hence how the Padauk chips) function.

I grabbed the relevant files and then tweaked the PCB to be outrageously large by comparison to the original. As always, there are mistakes - the holes for the 1N5817 diodes are too small, and the holes for the through-hole capacitors are too close together.



But the programmer loads the firmware when finished - and the next step is to make sure that it can program a Padauk chip, particularly the PFS154.

If you would like to have a tweak or two - here are the gerber files - at this stage (edit: now Aug 2022, this version DOES NOT WORK as is).

Thank you to PCBWAY for their sponsorship, support and advice. Here is the result:





Saturday, October 24, 2020

0000 0000 0100 0110

Hot Chips in an oven

No, this is not a recipe blog all of a sudden! I am exploring all options to make the pesky PADAUK FreePDK programmer project as to date my ham-fisted soldering has resulted in a melted mess rather than the expected lovely PCB goodness. To that end, I bought a cheap oven.

Temperature control is clearly fairly rudimentary on the original unit, and in fact it is possible to buy control circuitry to bake perfect chips as per the heating/cooling profiles for various solder paste formulations.


Instead (and because I'm cheap) I'm going to press into service a combination of an appropriate K-type thermocouple, plus a MAX6675 to help an AVR to interpret and plot the temperature inside the oven. I'm hoping the combination of live monitoring and mad flicking of switches might give me enough control to make the solder flow. The unknown at this stage is my ability to smear solder paste WITHOUT a stencil! What was I thinking? Oh yeah, cheap...

Firstly I hooked up the thermocouple to the MAX6675 module, loaded up example code, made a few quick modifications and ran the program to see if it worked.

/*

ATMega8A temperature probe
https://github.com/YuriiSalimov/MAX6675_Thermocouple
OneCircuit Tuesday 20 October 22:28:10 AEDT 2020
*/ #include <Thermocouple.h> #include <MAX6675_Thermocouple.h> #include <SmoothThermocouple.h> #include <TM1637Display.h> #define SCK_PIN 6 #define CS_PIN 7 #define SO_PIN 8 #define CLK 13 #define DIO 12 int temperature = 0; #define SMOOTHING_FACTOR 5 Thermocouple* thermocouple = NULL; TM1637Display display(CLK, DIO); void setup() { display.setBrightness(0x02); Thermocouple* originThermocouple = new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN); thermocouple = new SmoothThermocouple(originThermocouple, SMOOTHING_FACTOR); } void loop() { const double celsius = thermocouple->readCelsius(); display.showNumberDec((int)celsius, false); delay(500); }

Then I did the OLED thing...

/*
  Code based on:
  https://github.com/YuriiSalimov/MAX6675_Thermocouple
  https://github.com/olikraus/u8glib/
  
  OneCircuit Tuesday 20 October 23:08:11 AEDT 2020
*/ #include <Thermocouple.h> #include <MAX6675_Thermocouple.h> #include <SmoothThermocouple.h> #include "U8glib.h" #define SCK_PIN 6 #define CS_PIN 7 #define SO_PIN 8 int temperature = 0; int timer = 0; #define SMOOTHING_FACTOR 5 Thermocouple* thermocouple = NULL; U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); void draw(int howlong, int howhot) { u8g.setFont(u8g_font_unifont); u8g.setFontPosTop(); u8g.drawStr(1, 1, "OneCircuit"); u8g.drawHLine(1, 1 + 14, 78); u8g.drawStr(1, 25, "Time(s): "); u8g.setPrintPos(75, 25); u8g.print(howlong); u8g.drawStr(1, 40, "Temp(C): "); u8g.setPrintPos(75, 40); u8g.print(howhot); } void setup() { Thermocouple* originThermocouple = new MAX6675_Thermocouple(SCK_PIN, CS_PIN, SO_PIN); thermocouple = new SmoothThermocouple(originThermocouple, SMOOTHING_FACTOR); u8g.setRot180(); if ( u8g.getMode() == U8G_MODE_R3G3B2 ) u8g.setColorIndex(255); else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) u8g.setColorIndex(3); else if ( u8g.getMode() == U8G_MODE_BW ) u8g.setColorIndex(1); } void loop() { const double celsius = thermocouple->readCelsius(); temperature = int(celsius); u8g.firstPage(); do { draw(timer, temperature); } while ( u8g.nextPage() ); delay(1000); timer++; }

/*
Sketch uses 14696 bytes (44%) of program storage space.
Maximum is 32768 bytes.
Global variables use 330 bytes (16%) of dynamic memory,
leaving 1718 bytes for local variables. Maximum is 2048 bytes.
*/



Soon I'll fire up the oven with an actual PCB in it - and then mock up the ATMega328p based control/measuring unit. Will the madness ever end? <nope>







Saturday, October 17, 2020

0000 0000 0100 0101

BME280 as an altimeter

The BME280 is a useful critter which can accurately measure temperature, humidity and air pressure. It's a little more expensive than some of it's cousins (e.g. the BMP280), but packs a lot of punch into a tiny I2C driven module.


I have used the module before for tracking all three measurements (in the long running "hot house" project), but I was asked if I could make an altimeter for a school science project. Challenge accepted! Using the well known science principle that air pressure drops with altitude, I was able to adapt the code that Adafruit provides and put together a cute little project box with the required outcome.

/***************************************************************************
  Altimeter based on http://www.adafruit.com/products/2650

  OneCircuit Monday 12 October  19:27:44 AEDT 2020
 ***************************************************************************/

#include <Wire.h>
#include <SPI.h>
#include <TM1637Display.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <SimpleRotary.h>

#define CLK 2
#define DIO 3
float SEALEVELPRESSURE_HPA = 1000;
float SEALEVELPRESSURE_HPA_PREC = 0;
volatile byte pushed = 0;
volatile byte whichway = 0;
unsigned long delayTime = 500;

SimpleRotary rotary(6, 5, 7);
TM1637Display display(CLK, DIO);
Adafruit_BME280 bme;

void printValues() {
  float alt = bme.readAltitude(SEALEVELPRESSURE_HPA);
  display.setBrightness(0x0f);
  display.showNumberDec(alt);
}

void setup() {
  rotary.setTrigger(HIGH);
  rotary.setDebounceDelay(5);
  rotary.setErrorDelay(250);
  unsigned status;
  status = bme.begin();
  if (!status) {
    while (1);
  }
}

void loop() {
  pushed = rotary.push();
  if (pushed == 1) {
    pushed = 0;
    while (pushed == 0) {
      display.setBrightness(0x0f);
      display.showNumberDec(SEALEVELPRESSURE_HPA);
      pushed = rotary.push();
      whichway = rotary.rotate();
      if (whichway == 1) {
        SEALEVELPRESSURE_HPA++;
      }
      if (whichway == 2) {
        SEALEVELPRESSURE_HPA--;
      }
    }
    pushed = 0;
    while (pushed == 0) {
      display.setBrightness(0x0f);
      display.showNumberDec(SEALEVELPRESSURE_HPA_PREC);
      pushed = rotary.push();
      whichway = rotary.rotate();
      if ((whichway == 1) && (SEALEVELPRESSURE_HPA_PREC < 9)) {
        SEALEVELPRESSURE_HPA_PREC++;
      }
      if ((whichway == 2) && (SEALEVELPRESSURE_HPA_PREC > 0)) {
        SEALEVELPRESSURE_HPA_PREC--;
      }
    }
    SEALEVELPRESSURE_HPA = SEALEVELPRESSURE_HPA + SEALEVELPRESSURE_HPA_PREC / 10;

  }
  printValues();
  delay(delayTime);
}

/***************************************************************************
Sketch uses 12144 bytes (39%) of program storage space.
Maximum is 30720 bytes.
Global variables use 534 bytes (26%) of dynamic memory,
leaving 1514 bytes for local variables. Maximum is 2048 bytes.
 ***************************************************************************/

Packaged up in a box with a Nano doing the grunt work the project looks like a bit of dog's breakfast, but it actually works well as intended. If I had the time I'd look into modifying the code a bit to take into account the rotary encoder switch bounce, probably using this site as a resource.


And here is the little chap sitting on the console of our car as we bounce down our ridiculously bumpy driveway.


All in all a nice little project that shows the value of third party libraries when you need fast results to fulfill a request (in this case for an altimeter).






Saturday, October 10, 2020

0000 0000 0100 0100

ATMega8A and ATMega329P Programming Shield (PADAUK again?)

My world is coloured by PADAUK at the moment because I am like a dog with a bone.

Yeah, maybe this is bigger than anticipated

One idea for making a working FreePDK programmer is to use a reflow oven to help the soldering process. The first stage for me was to have an accurate temperature reading from the inside of the oven, close to the PCB, so that I can see the temperature profile of the oven as it heats and cools.

I can use all sorts of microcontroller options for this, but I did decide to try the ATMega8A in a 28-pin DIP package. This chip was the original μC in the Arduino UNO, before it was replaced by the ATMega328P.

Initially I wanted to press into service an AVR programming shield that arrived recently that sits atop an Arduino Uno to  program the raw μC.



In my usual staged approach™ I wrote some simple code to count on a TM1637 (which in the final project may display the temperature inside the oven). I may swap this out for an OLED that reports both time and temperature, and of course also eventually some PID code to control the oven to carefully follow a solder paste profile.

// ATMega8A and ATMega328P just count to test programmer
// OneCircuit Monday 28 September  14:35:20 AEST 2020

#include <TM1637Display.h>

// pins to talk to the TM1637 display
#define CLK 13
#define DIO 12

int currentcount = 0;             // counter
int address = 0;                // eeprom address

TM1637Display display(CLK, DIO);

void setup() {
  display.setBrightness(0x02);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop() {

  if (currentcount > 9999) {
    currentcount = 0;
  }

  display.showNumberDec(currentcount, false);
  delay(250);
  currentcount++;
}

No change of code is needed to go between these two processors, and the compiling reports are as follows:

ATMega8A

Sketch uses 1888 bytes (23%) of program storage space. Maximum is 8192 bytes.
Global variables use 32 bytes (3%) of dynamic memory, leaving 992 bytes for local variables. Maximum is 1024 bytes.

ATMega328P

Sketch uses 2182 bytes (6%) of program storage space. Maximum is 32768 bytes.
Global variables use 32 bytes (1%) of dynamic memory, leaving 2016 bytes for local variables. Maximum is 2048 bytes.

The program works fine on both microcontrollers, and the next step is to add the thermocouple and associated MAX6675 module and then see if we can actually read/report the sort of high temperatures expected inside the oven.