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.




No comments:

Post a Comment