328P Clock help

Not sure if this is in the right place for help. I tried to put under software and it would not let me post there.

I have a Nixie Clock kit bought 3 kits and the ATMEGA328P were bad and the seller won't replace the 328P's or send me the Hex file so I can get these kits working. I suck at programming but very good with hardware. I have a full schematic and would need some help making a sketch and get these Nixie clocks working.

I'd prefer if I can get a very simple sketch working enough to were this guy will replace the three 328P's that are bad. I put the chips in my programmer and it reads I don't have a chip in the programmer to program! I tried to explain this to them and they are saying they don't understand what was wrong. Pretty sad right!! and not supporting their product!! I'd be willing to Pay or give a working kit to whom ever helps.

The 328P is hooked up to a K155ИД1 that drives the 6 tube cathodes segments and 6 opto-isolators that strobe the Anodes to the separate Nixies and also uses a DS3231 for the time base. Like I said I could also send the schematic to where these signals come out of the 328P.

Hope someone could help?? Thanks much in advance and reading!

Thread moved to Programming.

You will very likely be asked to post a schematic and a description of how you want your clock to work.

Ho do you intend to get that "very simple sketch working" if the programmer doesn't even recognize that the processor chip is inserted?

I have New chips on order. They should be here in a couple days.

I have a schematic for the programmer

Which kit from where?

Post it here. We'll wait.

Can you program and verify placing on the chip anything? Even if you can't test it, can you program the blinking sketch onto this chip?

What programmer from where? Link to the instructions you are trying to follow.

a7

Extract the schematic yourself from that source and post it in some presentable form (pdf etc.) Post also a link to the vendor site from where you purchased the nixie clock kit.

To add an image to a post here simply copy and paste it into the post.

I built and published here a 6 digit nixie clock: Six Digit Nixie Clock . It was some time ago now.

I've taken your code with a few changes but not optimised it and I've assumed the pin numbers etc. are correct. It should display "091452" across the display (but you can change that in the code).

// 6 Digit Nixie
// ATMEGA328P

#define A 18  // pin 3 on the K1551D1 Chip
#define B 2   // pin 6 on the K1551D1 Chip
#define C 3   // pin 7 on the K1551D1 Chip
#define D 19  // pin 4 on the K1551D1 Chip
// #define N1 4 // Nixie Tube 1
// #define N2 5 // Nixie Tube 2
// #define N3 6 // Nixie Tube 3
// #define N4 11 // Nixie Tube 4
// #define N5 12 // Nixie Tube 5
// #define N6 13 // Nixie Tube 6
#define UP 23  // Menu UP
#define DN 24  // Menu Down
#define MU 25  // Enter Menu
#define AL 14  // Alarm out

// anode pins - tubes numbered 0 to 5
const uint8_t anodes[6] = { 4, 5, 6, 11, 12, 13 };

// for later optimisation
uint8_t digits[10][4]{
  { 0, 0, 0, 0 },  // 0
  { 0, 0, 0, 1 },  // 1
  { 0, 0, 1, 0 },  // 2
  { 0, 0, 1, 1 },  // 3
  { 0, 1, 0, 0 },  // 4
  { 0, 1, 0, 1 },  // 5
  { 0, 1, 1, 0 },  // 6
  { 0, 1, 1, 1 },  // 7
  { 1, 0, 0, 0 },  // 8
  { 1, 0, 0, 1 }   // 9
};


// change this if required
uint8_t display[6] = { 0, 9, 1, 4, 5, 2 };  // this should appear on the display

void setup() {
  Serial.begin(115200);
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  for (uint8_t i = 0; i < 6; i++) {
    pinMode(anodes[i], OUTPUT);
  }
}

void loop() {
  static uint32_t laststrobeAtMs = 0;
  static uint8_t tube = 0;

  

  if (millis() - laststrobeAtMs > 4 ) {  // more than 5ms gives flicker
    laststrobeAtMs = millis();

    for (uint8_t i = 0; i < 6; i++) digitalWrite(anodes[i], LOW);  // all tubes off
 
    // for later optimisation
    digitalWrite(A, digits[display[tube]][3]);
    digitalWrite(B, digits[display[tube]][2]);
    digitalWrite(C, digits[display[tube]][1]);
    digitalWrite(D, digits[display[tube]][0]);

    /* 
    Serial.print ("tube ") ;
    Serial.println( tube );
    Serial.print (digits[display[tube]][3]) ;
    Serial.print (digits[display[tube]][2]) ;
    Serial.print (digits[display[tube]][1]) ;
    Serial.print (digits[display[tube]][0]) ;
    Serial.println() ;
    */ 

    digitalWrite(anodes[tube], HIGH);  // switch current tube anode on
    
    if ( ++tube >= 6) tube = 0;  // cycle to next tube

    // any other code goes here - don't block for too long
  }
}

Cool! Thank you! I will give it a try. I realize I had a bunch of things wrong but working on it.
I've been trying but a guess a little much to start with. I just with the Arduino stuff off and on I need to stick with it if I want to write code. I just was never good at it. In the past I tried to learn 'C' but could never grasp the syntax that was used.
I'll let you know shortly now. Thank you!

From that schematic fragment which you posted (post #9) it is clear that there is no crystal on that board so it is running at 8MHz (probably). This could limit your options if you are using Arduino to develop software for it, for example, you can't just develop a program on an Arduino Uno then lift the chip out of the Uno and put into that Nixie clock. When you provide a full schematic and tell more about where you got the thing from and what programmer you are attempting to use, you may may get more specific advice.

from post #9

Are the pins on the Aduino UNO not the same as the pins on the chip is what you are saying?

You can just copy and paste in these types of files:

The Uno Pins are the same as those in the Nixie clock because the processors are the same (ATmega328P). However the chip on the Uno has been configured differently. For example, the Uno's chip has a boot loader installed, has custom fuse settings, and it expects a 16MHz crystal.

You could, however, use a Uno to program a blank ATmega328P chip which you could then insert into the Nixie clock. Search for "barebones Arduino" to see ideas about how to do this. Your own programmer may also be able to do it. Post a description of it to be sure.

Right! I forgot a few things. I haven't messed with these for about 6 years now. Got to use the ISP port and set the clock flags in Microchip Studio, been awhile. I need to eat some memberberries!
I'll get back with you.


Well I imported the code to Microchip Studio Set it for Int RC 8Mhz PWRDWN/RESET: 6CK/14+0ms
verified before I uploaded the hex to the chip it does flash but only the 4 center tubes flash 4's
So I guess I still have something set wrong. I know I have my tubes hooked up correctly. I even made a PCB that holds the Nixies and wired like the picture attached. I'll check a few more things maybe I missed something.



How I have the software set for the Int RC

Which code are you attempting to run here? The original delivered by the Nixie clock supplier or the code sample I gave you (post #12) ?

You almost certainly don't want CKDIV8 fuse selected on the ATmega328P chip. That makes it run at only 1MHz. If the supplier delivers only a Hex file (as opposed to an Arduino sketch) you should also have been given configuration information for the raw ATmega328P chip.

Nothing from the Nixie kit Supplier except two Dead Chips.

Only the code you posted #12.

I do have raw chips. I used Microchip Studio to load your code and the chip was set for Ext OSC.

OK. I see. It appears that in your original program you have used the physical package pin numbers instead of the "Arduino" pin numbers. As I said, I assumed these were correct. Anyway, the revised code appears below:

// 6 Digit Nixie - Revised pins 
// ATMEGA328P

#define A 12  // pin 3 on the K1551D1 Chip
#define B 0   // pin 6 on the K1551D1 Chip
#define C 1   // pin 7 on the K1551D1 Chip
#define D 13  // pin 4 on the K1551D1 Chip
// #define N1 2 // Nixie Tube 1
// #define N2 3 // Nixie Tube 2
// #define N3 4 // Nixie Tube 3
// #define N4 5 // Nixie Tube 4
// #define N5 6 // Nixie Tube 5
// #define N6 7 // Nixie Tube 6
// #define UP 23  // Menu UP        physical pin !
// #define DN 24  // Menu Down      physical pin !
// #define MU 25  // Enter Menu     physical pin !
// #define AL 14  // Alarm out      physical pin !

// anode pins - tubes numbered 0 to 5
const uint8_t anodes[6] = { 2, 3, 4, 5, 6, 7 };

// for later optimisation
uint8_t digits[10][4]{
  { 0, 0, 0, 0 },  // 0
  { 0, 0, 0, 1 },  // 1
  { 0, 0, 1, 0 },  // 2
  { 0, 0, 1, 1 },  // 3
  { 0, 1, 0, 0 },  // 4
  { 0, 1, 0, 1 },  // 5
  { 0, 1, 1, 0 },  // 6
  { 0, 1, 1, 1 },  // 7
  { 1, 0, 0, 0 },  // 8
  { 1, 0, 0, 1 }   // 9
};


// change this if required
uint8_t display[6] = { 0, 9, 1, 4, 5, 2 };  // this should appear on the display

void setup() {
  Serial.begin(115200);
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  for (uint8_t i = 0; i < 6; i++) {
    pinMode(anodes[i], OUTPUT);
  }
}

void loop() {
  static uint32_t laststrobeAtMs = 0;
  static uint8_t tube = 0;

  

  if (millis() - laststrobeAtMs > 4 ) {  // more than 5ms gives flicker
    laststrobeAtMs = millis();

    for (uint8_t i = 0; i < 6; i++) digitalWrite(anodes[i], LOW);  // all tubes off
 
    // for later optimisation
    digitalWrite(A, digits[display[tube]][3]);
    digitalWrite(B, digits[display[tube]][2]);
    digitalWrite(C, digits[display[tube]][1]);
    digitalWrite(D, digits[display[tube]][0]);

    /* 
    Serial.print ("tube ") ;
    Serial.println( tube );
    Serial.print (digits[display[tube]][3]) ;
    Serial.print (digits[display[tube]][2]) ;
    Serial.print (digits[display[tube]][1]) ;
    Serial.print (digits[display[tube]][0]) ;
    Serial.println() ;
    */ 

    digitalWrite(anodes[tube], HIGH);  // switch current tube anode on
    
    if ( ++tube >= 6) tube = 0;  // cycle to next tube

    // any other code goes here - don't block for too long
  }
}

I'm not sure what you mean when you say this

On the target Nixie board there is not external oscillator (Crystal). If you have told it there was one, you may have bricked the chip, that is until you can supply an external oscillator and reprogram it. But the fuse settings (post#21) look correct apart from the CKDIV8 which looks odd.

On what device did you compile the code ? Can Microchip Studio compile Arduino code ?