Tuesday, April 6, 2021

PowerBook 520c Restoration - Battery Rebuild

I recently purchased a used PowerBook 520c at an auction. It was described as "powers on", so I had no idea if that meant it would boot up or the power light works. Fortunately, it booted up and appeared to be fully functional.

The PowerBook 500 series introduced several new features. It had the first touch pad, replacing the track ball. It had a 68040 processor but lacked an FPU. The 520c had a color passive matrix display. Not as clear as an active matrix display, but for the time, not shabby. It also came with two battery ports so you could double your battery life.

The NiMH cells in the battery had long given up and probably contained nothing but potassium hydroxide powder. You can find refurbished batteries online. But the company I checked out did not have good reviews and the cost was prohibitive. I decided to rebuild it myself after reading this thread

Materials

I used the Tenergy 9.6V Flat NiMH Battery Packs for RC Cars found here at Amazon (https://www.amazon.com/gp/product/B001BA292A/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1). My thought was that it would be easier than having to solder tabbed cells together myself. It contains eight AA size cells with tabs soldered together. 

You'll also need solder, a soldering iron, X-acto knife, insulating tape, nerves of steel...

Teardown and Rebuild

Sorry, I don't have photographs. I will probably be doing this again so I have another battery to double my untethered time. 

I stripped the shrink wrapped plastic shell from the batteries. It was obvious to me they wouldn't fit still wrapped in the plastic. And the Tamiya connector was useless. 

The outer end cap of the battery pulls off if you pull up along one of the long sides. It will feel as if you are about to break it when it comes free. I also carefully removed the battery contact cover from the opposite end. This will slide off if you lift the tab slightly.

I cut the battery housing apart using an X-acto knife to score the plastic along the seam between the housing halves. I took my time and made small cuts in an effort to avoid cutting any cells or the EMM board. 


  


If you place the battery with the EMM board facing away from you with the battery contacts to the right (image above), the cells in the battery are arranged in series, starting at the top left negative end soldered to one end of the ribbon cable with six cells until you reach one end of the fuse. The other end of the fuse then connects to the remaining two cells that are flipped around from the orientation of the first six cells. I cut the ribbon cable from the cells by cutting the tabs off the cells leaving them soldered to the ribbon cable.

To use the Tenergy cells, I was required to clip the last two cells free, turn them end over end, and solder the fuse on so it had the same orientation as the original cells. Then I soldered the ribbon cable to the new cells using the tabs still attached to the ribbon cable. 


Once I had the cells and fuse together, I attempted to drop them into the battery housing and found that they were slightly longer (1 or 2 mm) and of a smaller diameter than the original cells. I was able to cut away enough of the internal supporting structure from both halves of the housing to make room for them to fit - but just barely. 




 

Reassembly was pretty tight. The Tenergy cells had carboard insulating on the ends of the cells that I had to remove and replace with insulating tape. The end cap goes on straight instead of rotating off. You need to use a fine point (I used a paper clip) to compress the spring in the battery latch while you push the end cap back on. The battery contact cover just slides back on.

 

I used freeware software package named EMMpathy. The software was designed specifically to recondition batteries on PowerBook 500 series  It reported the EMM memory as corrupt and the battery would not charge. What little charge it had started to dissipate. However, someone suggested that I check the power adapter. I hadn't realized it had two lines, one for the laptop main power and a second for charging the battery. Sure enough, my power adapter had a bad battery line. I found a tested replacement on Ebay, the batteries charged and discharged just fine. I was able to get nearly 2 hours of charge from the one battery I have. 

 

Here's a time lapse video of it discharging.



Sunday, February 28, 2021

Retro Computing: Macintosh SE FDHD -> WiFi232 Modem -> Raspberry Pi PPP Server -> Internet

Retro Computing:
Connecting a Macintosh SE to the Internet


Introduction

The basic idea is to connect the Macintosh to the Internet. This Mac does not have a network card, so I'm using a serial interface to get to a PPP server. Instead of a direct serial connection to the PPP server, I'm using a WiFi232 modem that provides a wireless connection to the PPP server. A bit complex, right?


So why not just use a serial connection directly from the Mac to the Rpi? I'm beginning to think I may need to try that. 

Materials

  • Macintosh SE FDHD
  • Sacrificial Mini Din8 serial cable 
  • Sacrificial DB9 serial cable
  • WiFi232 Modem 
  • Raspberry Pi Zero
  • 32 GB Micro SD Card
Most of the information to set this up can be found at http://podsix.org/articles/pimodem/. I think any WiFi232 Modem should work. I used this one RS232 Serial Wifi Modem for Vintage Computers V3

Build a straight through serial cable for your Macintosh to the WiFi232 Modem. My modem has a female DB9 connector. 

DB9              Mini Din 8
------           ----------
     1 
RXD  2 ---------- 5 RXD- Received data
TXD  3 ---------- 3 TXD- Transmitted data
DTR  4
GND  5 ---+------ 4 GND  Signal ground
          +------ 8 RXD+ Received data
DSR  6 
RTS  7 ---------- 1 HSKo Handshake output
CTS  8 ---------- 2 HSKi Handshake input
     9
Shield ---------- Shield


I sacrificed an old Palm Pilot serial cable with a female DB9 connector and used a male-to-male DB9 adapter to connect the two. 

For the Macintosh you need a Mini Din8 connector. I cut a Mac serial cable 

Setup Raspberry Pi

Follow the usual instructions for setting up a Raspberry Pi. You can go headless if you like. We're going to either create or modify the following files:
/etc/ppp/options
/etc/ppp/pap-secrets
/etc/xinetd.d/pppd
/etc/xinetd.d/telnet
/usr/local/bin/ppplogin
/etc/hosts.allow
/etc/iptables.rules
/etc/sysctl.conf

Make sure you update and upgrade your RPi operating system. 

$ sudo apt-get update
$ sudo apt-get upgrade

Install telnet, xinetd, telnetd, and ppp. If you want to use ZMODEM file tranfers, include lrzsz

$ sudo apt install telnet xinetd telnetd ppp lrzsz

Allow pppd to run with elevated permissions.

$ sudo chmod a+s /usr/sbin/pppd

Create ppp user.

$ sudo useradd -m ppp
$ sudo usermod -aG dip ppp
$ sudo usermod -s /usr/sbin/pppd ppp
$ sudo touch /home/ppp/.hushlogin

Configure pppd. Backup the original files

$ sudo mv /etc/ppp/options /etc/ppp/options.orig
$ sudo mv /etc/ppp/pap-secrets /etc/ppp/pap-secrets.orig

Replace options with the following in the file /etc/ppp/options

$ sudo nano /etc/ppp/options

# We will be doing PPP over Telnet - disable serial control.
local
# Terminate connection if remote side stops responding.
lcp-echo-interval 30
lcp-echo-failure 4
# Debug adds a lot of detail into the system logs regarding PPP negotiation.
# This is helpful in debugging client issues.
debug
# IP addresses to use in local:remote format.  We use NAT to share
# the Wi-Fi connection, make sure these are outside of your real subnet.
192.192.1.1:192.192.1.2 
# Other sensible options
asyncmap 0
passive
noipx

Replace pap-secrets with the following in the file /etc/ppp/pap-secrets

$ sudo nano /etc/ppp/pap-secrets

# Allow any username/password
* * "" *

Configure xinetd to enable ppp over telnet in the file /etc/xinetd.d/pppd

$ sudo nano /etc/xinetd.d/pppd

service pppd
{
type = UNLISTED
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
server_args = -h -L /usr/local/bin/ppplogin
disable = no
bind = 0.0.0.0
port = 2323
}

Configure xinetd to enable telnet in the file /etc/xinetd.d/telnet

$ sudo nano /etc/xinetd.d/telnet

service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}

And in the file /usr/local/bin/ppplogin

$ sudo nano /usr/local/bin/ppplogin

#!/bin/bash
/bin/login -f ppp

Set the ppplogin script we created to be executable and enable xinetd.

$ sudo chmod +x /usr/local/bin/ppplogin

Edit /etc/hosts.allow and add the following. 

$ sudo nano /etc/hosts.allow

in.telnetd:ALL:ALLOW

Enable and start xinetd.

$ sudo systemctl enable xinetd
$ sudo systemctl restart xinetd

Make sure that xinetd is listening on port 2323:

$ netstat -an | grep :2323
tcp        0      0 0.0.0.0:2323            0.0.0.0:*               LISTEN

Configure IP masquerading (i.e. NAT).

$ sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
$ sudo sh -c "iptables-save > /etc/iptables.rules"

File iptables.rules should look something like this.

$ cat /etc/iptables.rules
# Generated by xtables-save v1.8.2 on Wed Feb 17 18:53:54 2021
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A POSTROUTING -o wlan0 -j MASQUERADE
COMMIT
# Completed on Wed Feb 17 18:53:54 2021

Edit /etc/sysctl.conf and uncomment the ip_forward line

$ sudo nano /etc/sysctl.conf

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1

Create script to restore iptables rules after reboot in file /etc/network/if-pre-up.d/iptables

$ sudo nano /etc/network/if-pre-up.d/iptables

#!/bin/bash
iptables-restore < /etc/iptables.rules

Make it executable and reboot

$ sudo chmod +x /etc/network/if-pre-up.d/iptables
$ sudo reboot

Make sure ip forwarding is enabled.

$ cat /proc/sys/net/ipv4/ip_forward
1

Check that the masquerade rule is in place

$ sudo iptables -t nat -L POSTROUTING -nv
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
    6   573 MASQUERADE  all  --  *      wlan0   0.0.0.0/0            0.0.0.0/0
 pkts bytes target     prot opt in     out     source               destination         

Setup Your Macintosh

Now to the Macintosh.

I'm setting this up on System 7.5.1. 

MacPPP

The 68000 processor of the Mac SE prevents using Open Transport so you'll need MacPPP instead. You need MacPPP, 

MacTCP

You'll also need MacTCP. I'm using Glenn's MacTCP patched version 2.1 available at http://www.mactcp.org.nz/mactcp.html.

MacTCP Watcher 1.1.0

This tool will allow you to test your network with Ping, UDP, TCP, and DNS. You can also use MacPing but, as named, it only tests ping.

NCSA Mosaic 1.0.3

Or some other browser. There are several that work with a 68000. 

ZTerm 1.0.1 

ZTerm is handy for telnet sessions. I this by getting telnet to work first.

Installation & Configuration

There are several guides for installing and configuring MacTCP and MacPPP. I'll go over the settings I've tried.

MacTCP

You'll need MacPPP installed before you can configure MacTCP. 

Select PPP.
Click the "More..." button.
Select the following options:

    Obtain Address: Manually
    Subnet mask: 255.255.255.0 
    Router address: 192.168.1.1
    Domain: .
    IP Address: 8.8.8.8


MacPPP

Port Name: Modem Port
Idle Timeout (minutes): None
Echo Interval (seconds): Off
Terminal Window: unchecked
Hangup on Close: checked
Quite Mode: checked


Create a new PPP Server by clicking "New..." and entering a name. Mine is "Raspberry Pi"
Select the following options:

    PPP Server Name: Raspberry Pi
    Port Speed: 57600*
    Flow Control: CTS & RTS (DTR)
    Tone Dial: checked
    Phone num: 192.168.1.33:2323**
    Modem Init: ATNET1***
    Modem connect timeout: 90 seconds

   
Under LCP Options I left the defaults. I did try changing the MRU Local and Remote values to 500 to no effect. I also tried to following the settings recommended at https://www.jagshouse.com/PPPGuide.html with no change in the result.


Under IPCP Options I left most of the defaults. I inserted the Local and Remote IP Addresses from the PPP configuration on the RPi. 
    Local: 192.192.1.2 
    Remote: 192.192.1.1


*I've tried this at 9600 to see if I was serial speed issues. 9600 is basically a safe speed to test at. Didn't make a difference in the results.

** This is the IP address of the Raspberry Pi and the port configured for the PPP interface.

***ATNET1 puts the WiFi232 modem in telnet mode.

Conclusion

I must admit, this was not entirely successful and I'm having difficulty sorting out what is wrong. 

DNS works.


ICMP (ping) works. 

TCP does not work.


And can anyone tell me what this error number represents -23098? I cannot find any documentation for MacTCP Watcher.



A tcpdump of the ppp0 interface when pinging google.com gives the following:

$ sudo tcpdump -i any -A  -nvvv host 192.192.1.2
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes 
16:37:07.042160 IP (tos 0x0, ttl 255, id 44, offset 0, flags [none], proto ICMP (1), length 42)
    192.192.1.2 > 172.217.6.14: ICMP echo request, id 31047, seq 0, length 22
E..*.,....F............%yG...Watcher......
16:37:07.161128 IP (tos 0x0, ttl 113, id 0, offset 0, flags [none], proto ICMP (1), length 42)
    172.217.6.14 > 192.192.1.2: ICMP echo reply, id 31047, seq 0, length 22
E..*....q..)...........%yG...Watcher......

And when testing TCP, it retries several times before giving up with "TCP test to google.com failed (-23098)". 

Trying with the IP address gives the same result:

16:40:30.730573 IP (tos 0x0, ttl 60, id 54, offset 0, flags [none], proto TCP (6), length 44)
    192.192.1.2.1313 > 172.217.6.14.7: Flags [S], cksum 0xf6b0 (correct), seq 2406388000, win 2737, options [mss 536], length 0
E..,.6..<.      ..........!...n. ....`.
.........
16:40:34.188019 IP (tos 0x0, ttl 60, id 55, offset 0, flags [none], proto TCP (6), length 44)
    192.192.1.2.1313 > 172.217.6.14.7: Flags [S], cksum 0xf6b0 (correct), seq 2406388000, win 2737, options [mss 536], length 0
E..,.7..<.      ..........!...n. ....`.
.........
16:40:36.960130 IP (tos 0x0, ttl 60, id 56, offset 0, flags [none], proto TCP (6), length 44)
    192.192.1.2.1313 > 172.217.6.14.7: Flags [S], cksum 0xf6b0 (correct), seq 2406388000, win 2737, options [mss 536], length 0
E..,.8..<.      ..........!...n. ....`.
.........
16:40:43.197576 IP (tos 0x0, ttl 60, id 57, offset 0, flags [none], proto TCP (6), length 44)
    192.192.1.2.1313 > 172.217.6.14.7: Flags [S], cksum 0xf6b0 (correct), seq 2406388000, win 2737, options [mss 536], length 0
E..,.9..<.      ..........!...n. ....`.
.........