Friday, November 18, 2016

Functional TRS-80 Model 1 on Windows 10?


Ok, what does this have to do with Arduino or Raspberry Pi? Well, I am working on a couple of Pi emulating antique computer projects, and said, let's try this! I could use some financial help with a few projects we are working on, so use the "Donate" button found on this page, and I'll send you a zip file with a working TRS-80 Model 1 emulator (ROM included). Just unzip and run an old friend ....

Tuesday, November 15, 2016

Arduino Scale Speedometer Part 3 - Port Expander

The three 7 segment LED's from part 2 require 24 i/o pins on the Arduino. We can use port expanders to limit that to 2 pins, the I2c connections. Each MCP23017 chip supports 16 i/o pins, so two chips will do, and still only use the two lines on the Arduino, as they are addressable. In our previous two MCP23017 posts we show how to connect and address the MCP23017 chips and provide a link to the datasheet.

1st Digit - Chip 1 Port A Connections:
GPA7 -> A7
GPA6 -> B6
GPA5 -> C4
GPA4 -> D2
GPA3 -> E1
GPA2 -> F9
GPA1 -> G10
GPA0 -> DP5

2nd Digit - Chip 1 Port B Connections:
GPB7 -> A7
GPB6 -> B6
GPB5 -> C4
GPB4 -> D2
GPB3 -> E1
GPB2 -> F9
GPB1 -> G10
GPB0 -> DP5

3rd Digit - Chip 2 Port A Connections:
GPA7 -> A7
GPA6 -> B6
GPA5 -> C4
GPA4 -> D2
GPA3 -> E1
GPA2 -> F9
GPA1 -> G10
GPA0 -> DP5



To send the speed determined in part 1 to the 3 digit display, we need to break up the number into 3 separate numbers, the hundreds, tens, and ones position. This is done with a simple calculation:

first=number/100;
second=number%100/10;
third=number%10;

Then in a case statement you can send the correct code to each chip:

switch (var) {
    case 0:
      Wire.write(244); //11110100
      break;
    case 1:
      Wire.write(96); //01100000
      break;
    case 2:
      Wire.write(218); //11011010
      break;
    case 3:
      Wire.write(242); //11110010
      break;
    case 4:
      Wire.write(102); //01100110
      break;
    case 5:
      Wire.write(182); //10110110
      break;
    case 6:
      Wire.write(190); //10111110
      break;
    case 7:
      Wire.write(224); //11100000
      break;
    case 8:
      Wire.write(254); //11111110
      break;
    case 9:
      Wire.write(230); //11100110
      break;
    case DP:
      Wire.write(1); //00000001
      break;
    default:
      // if nothing else matches, do the default
      // default is optional
    break;
  }

Now, if all this seems very complicated, and the 24 wires from the 3 digits to the two MCP23017 chips seems like spaghetti, you are right, and we have chosen to go a different path. The Adafruit I2C 4 digit display. More on that tomorrow .....

Monday, November 14, 2016

Arduino Scale Speedometer Part 2 - 7 Segment LED's

In part two (see part 1 for the train detection circuit) we are addressing the three 7 segment displays. We are using Common Anode displays, so we send a low to each segment to light them up. Use whatever you have available, and use the data sheet for your displays and map accordingly.


 This image shows each segment, and assigns a letter to each, to help with the wiring.






The next image shows the pin numbers and positions looking at the face of the display.

Now we show which segment is assigned to which pin, and the polarity of the pins. Since we are using Common Anode, the LED symbols point down,or away from the common positive (5v) signal (pins 3 & 8). A LOW is sent to each pin to light up the associated segment. If you are using Common Cathode, then the diodes would point up, 3 & 8 would connect to ground, and a HIGH would be sent to each segment to light them.

As is the case with all LED's, a current limiting resistor is needed to prevent the LED from burning out. The one you pick is dependent upon your source voltage, and the LED. We are using 400 Ohm resistors for this project.

The next post will address using a I2C port expander to free up the 24 pins the display uses.
Related Posts Plugin for WordPress, Blogger...