Categories
CircuitPython Microcontroller Software Development

PyPortal Event Countdown Clock Mods III

Some big updates to the software for the modified PyPortal Event Countdown Clock. The UI was changed and several features added. It also seems to be more stable as it does not lock-up randomly. Let’s get into the changes.

  • Header and Footer status bars display information
    • Header
      • Temperature
        • Touch to change between Fahrenheit and Celsius
      • Time
        • Touch to change between 24 hour and 12 hour formats
      • Network Strength
    • Footer
      • Brightness
        • Touching the left side of the footer, dims the display backlight
        • Touching the right side of the footer, increases the brightness of the display backlight
        • Touching the middle of the footer, returns to auto brightness of the display backlight
      • Event of the number of events
  • Change the event displayed by touching the left of the display to show previous event or the right side to advance to the next event.
  • If an event has passed more than a day ago, they will be removed from the list of events and no longer displayed
  • The events do not need to be in order in the JSON file. They are sorted when they are loaded from the SD Card with the soonest event being displayed first.
Demo of the PyPortal Event Countdown Clock Mods

Noticed that the temperature was several degrees too high. This was due to the ADT7410 being too close to devices generating heat. I removed the ADT7410 and placed it on a small board and added a PH2 JST connector so it may be plugged into the I2C socket. This resulted in much more usable temperature reading.

PyPortal Event Countdown with temperature sensor moved off the PyPortal
ADT7410 Temperature Sensor moved to a separate board.

Adafruit PyPortal Titano

I just purchased an Adafruit PyPortal Titano, Product ID: 4444, to test out the software and see about allowing the software to be used on different sized screens. The Titano, has a 480×320 screen verses 320×240 of the PyPortal, Product ID: 4116.

The PyPortal Titano that I received had CircuitPython 5 installed, so the first order of business was to install CircuitPython 8. I started by going to the PyPortal CircuitPython Guide on Learn.Adafruit.

  1. Download the latest version of CircuitPython for the PyPortal Titano board by going to https://circuitpython.org/board/pyportal_titano/
  2. Download the UF2 file for CircuitPython 8.0.5
  3. Double click the reset button on the back of the Titano board and make certain the RGB LED turns green. If is is not green, try again.
  4. Copy the file to the PORTALBOOT drive that shows on your PC
    NOTE: Do not be concerned that the preinstalled demo no longer works. The library files are different for different versions.
  5. Download the CircuitPython 8 library files from https://circuitpython.org/libraries
    NOTE: This step is optional as the required libraries are in the GitHub project files
  6. Go to GitHub and download the project files from https://github.com/richteel/PyPortal_Events
  7. Delete the files on the PyPortal Titano
  8. Unzip the files and copy the files in the PyPortal folder to the PyPortal Titano
  9. The PyPortal Titano will restart and the images will change between “Connecting to the Internet” and “Failed to Connect”. The images will not take up the full screen due to the difference in resolution. (Until the code is modified.) The reason it is not connecting is we need add files to an SD Card and put that into the PyPortal Titano.
  10. Copy the files in the SD_Card folder, from GitHub, and paste them into the root of a micro SD Card.
  11. While the SD Card is still in you PC, double click on the index.html file to open the configuration utility.
  12. You may choose to load the config.json file on the card or start creating a new file from scratch by adding new events.
  13. Once you are satisfied with the events, click on the “Secrets” tab and enter your Wi-Fi settings, Timezone, and Adafruit IO Account information.
  14. Once done, click the “Save JSON File” button and save it to the SD Card as config.json.
  15. Remove the card from the PC and insert it into the PyPortal Titano.
  16. Click the reset button on the back of the PyPortal Titano.
  17. If everything was done correctly, you can anticipate that the events will be displayed on the screen
PyPortal Event Countdown running on the PyPortal Titano
The application is in the upper left corner of the screen with space to the right and bottom.

You may notice from the image of the PyPortal Titano screen, the temperature is not displayed as the PyPortal Titano does not have the ADT7410 Temperature Sensor.

The next step will be to see how to detect the screen size or make it a setting in the config.json file.

Categories
CircuitPython Software Development Web Application Development

PyPortal Event Countdown Clock Mods II

I have implemented some of the items on my to do list from last week’s post and tested out a few more ideas. I have also published version 0.1 to GitHub.

I want to provide a few details on version 0.1 of the code and what is being worked for version 1.0. The two releases are very different with 1.0 being the one that I recommend you use once it is available.

Version 0.1 does automatically change the backlight brightness but it is not too dramatic therefore not very useful in my opinion. I’m disappointed by the way that turned out but plan to address it in version 1.0 with automatic and manual setting of the backlight.

Version 0.1 also freezes randomly, however I think it is a memory issue. I plan to address this by calling the CircuitPython garbage collection and/or implementing a watchdog timer. Not certain at the moment, which direction I will take but suspect that I will implement both.

Version 0.1 will also load all events, even those in the past so it is not very useful. Version 1.0 will address this by not loading past events.

The next version, 1.0, will have a different screen layout. As stated above, I wanted a way to manually control the backlighting so I have added icons at the bottom of the screen with touch target areas for increasing, decreasing, and automatic setting of the screen backlight. In order to add this as an option, I have created a 20 pixel high footer on the screen for the icons and to display brightness information. I may also display when the time is being updated as the touch interface is non-responsive during an update as it is a blocking call.

A 20 pixel header will also be included to display the time, the current event of the number of events, and a network strength indicator. The header and footer take away 40 pixels from the screen height but I think it will be worth it.

Hopefully I will finish this new version shortly and will have it available on GitHub. As you may have guessed, I will be on vacation/holiday for two weeks in about two weeks so there will not be any posts while I am away, unless it is about the vacation and I have stable enough internet to make some posts.

Categories
CircuitPython Microcontroller

PyPortal Event Countdown Clock Mods

I recently purchased an Adafruit PyPortal and looked at using John Park’s project PyPortal Event Countdown Clock project. It was fairly easy to get it up an running but switching from CircuitPython 4 to 8, proved to cause a bit of a challenge, not with the code, but with the libraries. Some were moved from one file to multiple files in one folder but eventually, I got it all sorted out.

I plan to use the PyPortal on an upcoming cruise, which lead me to some ideas of how to change the code to make it a bit more useful and easier to change events. Below is a list of some of the ideas to be implemented.

  • (Implemented) Allow for multiple events to be tracked
  • (Implemented) Use touch to change which event is being displayed
  • (Implemented) Add title and subtitle to the display
  • Load the events and event images from an SD Card
    • Use a JSON file
    • Create a webpage to easily modify the JSON
  • If possible, add the WiFi information to the config file
  • Add a clock option and easily switch between countdown and clock
  • Dim or turn off the backlight if the room is dark
  • Ignore events that have passed (Date is not today but in the past)

The first step was to add multiple events and add touch capability to allow moving back and forth through the events. Adding multiple events was not difficult. A new class files was added for event objects and a list was created to hold them. Next was to add touch and split the screen in half with a 20 pixel dead zone in the middle so that touching the left side would take you to the previous event and touching the right side would move to the next event. It was also necessary to add a variable to track the last index so we would know when to load the selected event.

Touch Zones for event change
Touch zones on PyPortal 320×240 screen

event.py

import time


class event:
    def __init__(self, title, subtitle, year, month, day, hour, minute, imageCountDown, imageEventDay, forecolor=0xF0C810):
        self.title = title
        self.subtitle = subtitle
        self.forecolor = forecolor
        self.year = year
        self.month = month
        self.day = day
        self.hour = hour
        self.minute = minute
        self.date = time.struct_time((year, month, day,
                                      hour, minute, 0,  # we don't track seconds
                                      -1, -1, False))  # we dont know day of week/year or DST
        self.imageCountDown = imageCountDown
        self.imageEventDay = imageEventDay

code.py

# SPDX-FileCopyrightText: 2019 Limor Fried for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""
This example will figure out the current local time using the internet, and
then draw out a countdown clock until an event occurs!
Once the event is happening, a new graphic is shown
"""
import time
import board
import busio
from adafruit_pyportal import PyPortal
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
from analogio import AnalogIn
import adafruit_adt7410
import adafruit_touchscreen
from event import event

events = []

events.append(event("Day 1", "Barcelona, Spain",
              2023, 5, 29, 00, 00,
              "barcelona_background.bmp", "barcelona_event.bmp"))
events.append(event("Day 2", "Fun Day At Sea",
              2023, 5, 30, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 3", "Málaga, Spain",
              2023, 5, 31, 00, 00,
              "countdown_background.bmp", "countdown_event.bmp"))
events.append(event("Day 4", "Gibraltar (UK)",
              2023, 6, 1, 00, 00,
              "countdown_background.bmp", "countdown_event.bmp"))
events.append(event("Day 5", "Lisbon, Portugal",
              2023, 6, 2, 00, 00,
              "countdown_background.bmp", "countdown_event.bmp"))
events.append(event("Day 6", "Fun Day At Sea",
              2023, 6, 3, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 7", "Fun Day At Sea",
              2023, 6, 4, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 8", "Fun Day At Sea",
              2023, 6, 5, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 9", "Fun Day At Sea",
              2023, 6, 6, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 10", "Fun Day At Sea",
              2023, 6, 7, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 11", "Fun Day At Sea",
              2023, 6, 8, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 12", "Fun Day At Sea",
              2023, 6, 9, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 13", "Fun Day At Sea",
              2023, 6, 10, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 14", "Fun Day At Sea",
              2023, 6, 11, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 15", "Fun Day At Sea",
              2023, 6, 12, 00, 00,
              "funday_background.bmp", "funday_event.bmp"))
events.append(event("Day 16", "New York, New York",
              2023, 6, 13, 00, 00,
              "nyc_background.bmp", "nyc_event.bmp"))


# determine the current working directory
# needed so we know where to find files
cwd = ("/"+__file__).rsplit('/', 1)[0]
# Initialize the pyportal object and let us know what data to fetch and where
# to display it
pyportal = PyPortal(status_neopixel=board.NEOPIXEL,
                    default_bg=cwd+"/coming_soon.bmp")

big_font = bitmap_font.load_font(cwd+"/fonts/Helvetica-Bold-36.bdf")
big_font.load_glyphs(b'0123456789')  # pre-load glyphs for fast printing
title_font = bitmap_font.load_font(cwd+"/fonts/Arial-36.bdf")
subtitle_font = bitmap_font.load_font(cwd+"/fonts/Arial-20.bdf")

text_color = 0xFFFFFF
days_position = (big_font, 8, 207)
hours_position = (big_font, 110, 207)
minutes_position = (big_font, 220, 207)
title_position = (title_font, 8, 140)
subtitle_position = (subtitle_font, 8, 175)

text_areas = []
for pos in (days_position, hours_position, minutes_position, title_position, subtitle_position):
    textarea = Label(pos[0])
    textarea.x = pos[1]
    textarea.y = pos[2]
    textarea.color = text_color
    pyportal.splash.append(textarea)
    text_areas.append(textarea)

refresh_time = None

# Touchscreen setup
# ------Rotate 270:
screen_width = 240
screen_height = 320
ts = adafruit_touchscreen.Touchscreen(board.TOUCH_XL, board.TOUCH_XR,
                                      board.TOUCH_YD, board.TOUCH_YU,
                                      calibration=(
                                          (5200, 59000), (5800, 57000)),
                                      size=(screen_width, screen_height))

# ------------- Inputs and Outputs Setup ------------- #
light_sensor = AnalogIn(board.LIGHT)
try:
    # attempt to init. the temperature sensor
    i2c_bus = busio.I2C(board.SCL, board.SDA)
    adt = adafruit_adt7410.ADT7410(i2c_bus, address=0x48)
    adt.high_resolution = True
except ValueError:
    # Did not find ADT7410. Probably running on Titano or Pynt
    adt = None

event_index = 0
last_event_index = -1

while True:
    touch = ts.touch_point
    light = light_sensor.value

    if touch:
        # print(f"Touched x={ts.touch_point[0]}, y={ts.touch_point[1]}")
        if touch[0] < 150:
            event_index = event_index - 1
            if event_index < 0:
                event_index = len(events) - 1
        elif touch[0] > 170:
            event_index = event_index + 1
            if event_index > len(events) - 1:
                event_index = 0

    if event_index != last_event_index:
        pyportal.set_background(cwd + "/" + events[event_index].imageCountDown)
        text_areas[3].color = events[event_index].forecolor
        text_areas[3].text = events[event_index].title
        text_areas[4].color = events[event_index].forecolor
        text_areas[4].text = events[event_index].subtitle
        last_event_index = event_index

    # only query the online time once per hour (and on first run)
    if (not refresh_time) or (time.monotonic() - refresh_time) > 3600:
        try:
            print("Getting time from internet!")
            pyportal.get_local_time(False)
            refresh_time = time.monotonic()
        except RuntimeError as e:
            print("Some error occured, retrying! -", e)
            continue

    now = time.localtime()
    print("Current time:", now)
    remaining = time.mktime(events[event_index].date) - time.mktime(now)
    print("Time remaining (s):", remaining)
    if remaining < 0:
        # oh, its event time!
        pyportal.set_background(cwd + "/" + events[event_index].imageEventDay)
        while True:  # that's all folks
            pass
    secs_remaining = remaining % 60
    remaining //= 60
    mins_remaining = remaining % 60
    remaining //= 60
    hours_remaining = remaining % 24
    remaining //= 24
    days_remaining = remaining
    print("%d days, %d hours, %d minutes and %s seconds" %
          (days_remaining, hours_remaining, mins_remaining, secs_remaining))
    text_areas[0].text = '{:>2}'.format(days_remaining)  # set days textarea
    text_areas[1].text = '{:>2}'.format(hours_remaining)  # set hours textarea
    text_areas[2].text = '{:>2}'.format(mins_remaining)  # set minutes textarea

    # update every 10 seconds
    # time.sleep(10)

Short Demo of implementing multiple events

Categories
Android Arduino Meshtastic Microcontroller Raspberry Pi Pico Uncategorized

Meshtastic Serial

I wanted to see about connecting a Raspberry Pi Pico to a LillyGo TTGO T-Beam v1.1 device. I noticed that Meshtastic supports serial communications, so I decided to give it a go to see how it worked.

There are several serial modes but the ones that seem the most useful are TXTMSG and PROTO. First attempt will be with the TXTMSG Mode as that seems straight forward. Once the TXTMSG Mode is working, I will look into how to use the PROTO Mode.

Wiring

We need to connect the grounds between the two devices, then connect the transmit (TX) from one to the receive (RX) of the other device. Below is a table showing the connections used in my setup.

T-BeamPico
RX pin 13TX pin 1 (GP0)
TX pin 14RX pin 2 (GP1)
GNDGND
T-Beam and Pico wiring
Wiring between T-Beam and Raspberry Pi Pico

Meshtastic Setup

Meshtastic firmware was installed using the Web Installer at https://flasher.meshtastic.org/. The T-Beam came with Meshtastic preinstalled. You may need to use another method to install the firmware if the Web Installer does not work.

Meshtastic Web Installer
Meshtastic Web Installer

T-Beam TEXTMSG Mode

Once Meshtastic has been installed on the T-Beam device and connected to the Android or Apple application, go to the Module Settings to setup the serial connection on the T-Beam device. The Module Settings is accessed by clicking on the kebab menu (aka three vertical dots menu) and selecting “Module Settings”.

kebab menu
Kebab Menu
Module Settings menu item
Module Settings menu item

Once the Module settings are displayed, scroll down to the “Serial Config” section and set the following items.

  • Serial enabled: turn on
  • RX: Set it to the T-Beam pin number for receive, which is 13 in my setup.
  • TX: Set it to the T-Beam pin number for transmit, which is 14 in my setup.
  • Serial baud rate: May leave it at the default setting or set it to “BAUD_38400”. I think it is best to set it as the default baud rate may change in other versions. I believe I read that it did change in the past.
  • Serial mode: Set it to TEXTMSG
  • Once everything is set, click the “Send” button.
Serial Configuration
Serial Configuration

Pico Arduino Code

The Pico code is written in C++ using the Arduino IDE. It is necessary to configure use the Pico Board provided by Earle F. Philhower, III. First, add the URL, https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json, to the Additional Boards Manager URLs by going to File > Preferences in the menu.

Arduino Preferences Menu Item
Arduino Preferences Menu Item
Arduino IDE Preferences
Arduino IDE Preferences

Click the icon to the left of the “Additional boards manager URLs” entry. Add the URL to the a new line in the textbox and click the “OK” button.

Additional Boards Manager URLs
Additional Boards Manager URLs

Open the boards manager by clicking on the boards manager icon, type “Pico” in the search textbox, and install the board, Raspberry Pi Pico/RP2040 by Earle F. Philhower, III.

Boards Manager
Boards Manager

Once the board is installed, you may select it from the boards dropdown selection in the IDE, when the Pico is connected to the PC.

Pico selected in the boards drop-down list
Raspberry Pi Pico selected in the boards drop-down list
/*
  Sample code to allow the Pico to act as a serial bridge between the PC and the Meshtastic device.

  Data sent to the Pico using the Arduino Serial Monitor, PuTTY, or other terminal software is sent
  to the Meshtastic device over the Pico UART0/Serial1 connection. Any data received from the Meshtastic
  device to the Pico is relayed to the PC over the Pico's serial over USB connection.

  REFERENCES:
    - https://meshtastic.org/docs/settings/moduleconfig/serial
    - https://github.com/earlephilhower/arduino-pico/discussions/210
*/

void setup() {
  // PC to Pico
  Serial.begin(9600);
  // Pico to Meshtastic device
  Serial1.begin(38400);
  while (!Serial)
    ;  // Serial is via USB; wait for enumeration
}

void loop() {
  // If data is received from the Meshtastic device, send it to the PC over the USB connection
  if (Serial1.available()) {
    String receiveMessage = Serial1.readString();
    Serial.print("Message received on Serial1 is:  ");
    Serial.println(receiveMessage);  // Send to serial monitor
  }

  // If data is received from the PC, send it to the Meshtastic Device
  while (Serial.available()) {
    int inByte = Serial.read();
    Serial1.write(inByte);
  }
}

Upload the code to the Raspberry Pi Pico. Once the code is loaded, open the serial monitor and type some text and hit enter. The message will be received on the other node(s).

Sending message from PC
Sending message from PC
Message received on other node
Message received on other node

Sending a message from another node, will be received and shown in the serial terminal.

Sending message from another node
Sending message from another node
Receiving message on PC
Receiving message on PC

Now the simple TEXTMSG is working, we can try to get the PROTO working. The PROTO mode is interesting as it may be possible to configure the Meshtastic device, and query it for additional information. I will look into the PROTO Mode in the near future.

Categories
Psion Raspberry Pi

Psion Sidecar Part II

I’m going to dive in a bit on the Psion Sidecar that I covered last week and add some details to explain the RS232 connections and the switches on the Sidecar.

Male DB9 Connector

Male DB9 Connector pinouts
Male DB9 Connector pinouts
PinFunctionI/O Direction
1Data Carrier Detect (DCD)Input
2Receive Data (RD)Input
3Transmit Data (TD or SD)Output
4Data Terminal Ready (DTR)Output
5Signal Ground (SG)
6Data Set Ready (DSR)Input
7Request to Send (RTS)Output
8Clear to Send (CTS)Input
9Ring Indicator (RI)Input
PC DB9 Pinout

Sidecar DB9 Pinout

The silkscreen and case markings were confusing me at first. It was a bit difficult to understand which switch position was for a straight Data Terminal Equipment (DTE) connection and which was for a Data Communications Equipment (DCE) connection. The silk screen on the PCB indicate that when both switches are toward the DB9 connector, that it is a straight DTE connection and when they are away from the DB9 connector, they are in the crossover/null modem DCE configuration. The case indicates that if they are to the left, as you look at the switch, then it is straight through and to the right is crossover configuration. These two were not in agreement.

Using an ohm meter to trace the connections through to the Raspberry Pi, it was apparent that the case was more correct but the opposite of what my thought was regarding the symbols. I thought that the straight arrow indicated that the DB9 was in a DTE pinout and the crossover symbol as the DCE connection. It is actually the opposite. I think that Kian may be indicating what device it is connecting to rather than what the DB9 pinout of the Psion Sidecar is when the switch is in a particular position.

Switch Positions

  • Left – DCE Pinout: Use when connecting to a PC or another device with DTE pinout.
  • Right – DTE Pinout: Use when connecting to the Psion, modem, or other device with a DCE pinout.
PinDB9
TX:RX
RTS:CTS
(Right DTE)
DB9
TX:RX
RTS:CTS
(Left DCE)
SP3232E
TX:RX
RTS:CTS
(Right DTE)
SP3232E
TX:RX
RTS:CTS
(Left DCE)
Raspberry Pi
TX:RX
RTS:CTS
(Right DTE)
Raspberry Pi
TX:RX
RTS:CTS
(Left DCE)
1Not ConnectedNot ConnectedNot ConnectedNot ConnectedNot ConnectedNot Connected
2RDTD13->1214<-1110 GPIO158 GPIO14
3TDRD14<-1113->128 GPIO1410 GPIO15
4Not ConnectedNot ConnectedNot ConnectedNot ConnectedNot ConnectedNot Connected
5SGSG151566
6Not ConnectedNot ConnectedNot ConnectedNot ConnectedNot ConnectedNot Connected
7RTSCTS7<-108->911 GPIO1736 GPIO16
8CTSRTS8->97<-1036 GPIO1611 GPIO17
9Not ConnectedNot ConnectedNot ConnectedNot ConnectedNot ConnectedNot Connected
DB9 to Raspberry Pi Pinouts
SP3232E IC Pinout showing buffers
SP3232E IC Pinout Showing Buffers

Properly shutting down the Psion Sidecar

To properly shutdown the Raspberry Pi in the Sidecar, open the Hermes or other terminal application. Connect to the Sidecar using telnet on port 23. Once connected, login and issue the command “sudo shutdown now“. Once the green light on the Raspberry Pi stops blinking, you may press the power button to turn the unit off.

Hermes used to properly shutdown the Raspberry Pi in the Sidecar.
Properly shutdown the Raspberry Pi in the Sidecar using Hermes Terminal application

Conclusion

I hope this is helpful in understanding how properly shutdown the Psion Sidecar and how to use the switches. Typically the switches will be in the right position to allow communication with a Psion 5mx device using the Psion BB9 cable.

Kian’s design is very nice as it allows the Psion Sidecar to be used for other things without the need of a null modem to connect it to another device. The only thing that you may need is a F-F gender changer and DB9 to DB25 adapters. This makes it a versatile device to connect other devices.

Categories
Psion Raspberry Pi

Getting Psion 5mx on the Internet

I found a project that Kian Ryan put together to get his Psion 5mx on the internet. It will not run YouTube or provide the content that we are used to today but it can provide a 1990’s internet experience.

Kian wrote up his build in a few of his blog posts. Below is a list of his blog posts. Please check them out for more details.

When I saw the video of Kian on Tom’s hardware, I immediately went to his blog to see how he put it together. I had been thinking of doing something similar and seeing what Kian had would save me a great deal of time. I do plan to make another version of his project using IrDA. I already have the parts that I believe I will need to make it happen. I want to get the RS232 version working first. I sourced and ordered the parts that I did not have on hand. A little over 2 weeks later, the last parts arrived so I could get started.

The first thing that I worked on was building the PiRS232 board. I had not paid attention to Kian’s instruction to use tall headers. I did not have tall headers on hand so I had to order some. A couple days later, the proper headers arrived so I could complete the build.

Parts List & Sources

  1. Raspberry Pi Zero W
  2. Pimoroni LiPo Amigo Pro
  3. Pimoroni LiPo SHIM for Raspberry Pi
  4. 2200mah LiPo Battery with JST connector
  5. Double ended JST connector
  6. 2×20 Long Male Header (19mm 16mm)
  7. M2.5 10mm+6mm Nylon stand-offs (F-M), screws and nuts
  8. M2.5 5mm screws
  9. M3 brass inserts
  10. M3 round head hex nut 8mm bolts
  11. Case
    • Quantity: 1
    • Source: Print the 4 STL files in the Case folder in Kian’s GitHub Repository. Optionally, you may printed on Printables
  12. Assembled PiRS232 board (See parts list below)
Parts laid out and numbered
Parts laid out and numbered. (NOTE: Header is not correct as it is a short header. There are brass inserts already in the case but extras are laid out. Only 2 brass inserts are needed. Double ended JST cable is shown as 2 JST pigtails. These will be made into one cable.)

Parts for the PiRS232 Board

  1. PCB for PiRS232 board
    • Quantity: 1
    • Source: Use the PiRS232.kicad_pcb in Kian’s GitHub Repository and have it made at PCBWay, OSHPark, or other PCB manufacturer. Another way is to go to the OSHPark project that I created and order it from there.
  2. SP3232E
  3. 0.1uF Capacitors
  4. Switch Slide DPDT
  5. DB9 Male Right Angle
PiRS232 Board Parts Numbered
PiRS232 Board Parts Numbered

3D Printing the Parts

I had printed the parts with ABS filament on an XYZprinting da Vinci 1.0 3D Printer. Below are the images from Simplify3D showing the orientation of the pieces.

PiRS232 Board Build

The first step was to solder the 0.1uF capacitors to the board.

Capacitors soldered to the board
Capacitors soldered to the board

Next was to install the SP3232E IC. Take note of pin 1 and orientate the IC correctly. Start by soldering 2 opposing corner pins. Make certain that the IC is mounted flush, then solder the remaining pins.

Solder the opposing corner pins of the IC
Solder the opposing corner pins of the IC
PiRS232 board with the IC installed
PiRS232 board with the IC installed

The switches were next. The same principle of soldering opposing corner pins, checking placement, then soldering remaining pins was done with the switches and then the DB9 connector.

Soldering the first switch
Soldering the first switch
Both switches are in place
Both switches are in place
DB9 connector is installed
DB9 connector is installed

Putting the Stack Together

Once the correct headers arrived, I could get to work putting everything together and move on to the software.

Long and short headers compared
The regular and long headers. The long headers are need to put the stack together.

Soldering the long header to the Raspberry Pi Zero. The header that I have is 19mm but 16mm looks to be a better fit. After soldering the header, the excess needed to be trimmed with flush cutters. It is handy to use a breadboard to help keep the pins straight. It may be necessary to prop up the Raspberry Pi to keep everything straight. Again, start with opposite corner pins, check the alignment, adjust if necessary, then solder the remaining pins.

Place the LiPo Shim on the Raspberry Pi and solder in place. Make certain that it does not touch any components and remains parallel to the Raspberry Pi.

Install the 10mm+6mm standoffs with nuts.

I did not like how the pins from the switch were right on top of the power connection so I place a bit of electrical tape over the pins.

Secure the PiRS232 board to the standoffs and solder the header pins.

If your headers are long, then trim them flush with the board.

Secure the LiPo Amigo Pro to the 3D Printed Power Rest with two or three M2.5 5mm screws.

Checking the fit for the LiPo Amigo Pro, it looks like the screw for the DB9 connector is going to be in the way, so we will need to remove it. It also looks like the threaded bracket is in the way as well so that too needs to be removed.

The fit is better but it looks like we may still need to make an adjustment. We will see when it all goes into the case.

Everything is all wired up, now on to the software. It is tempting to install it in the case but we need to be certain that the software is configured and ready before stuffing it in the case as the card is not accessible once everything is installed.

Software Setup

Using the Raspberry Pi Imager, setup a headless installation. If you don’t have the Raspberry Pi Imager installed, head over to https://www.raspberrypi.com/software/ and download the Raspberry Pi imager. Once installed, launch it and click the “CHOOSE OS” button.

Click the “Raspberry Pi OS (other)” option

Click the “Raspberry Pi OS Lite (32-bit)” option.

Click the gear icon in the lower right corner.

Setup the following options.

  • Set a hostname
  • Enable SSH (Typically you will want to use password authentication.)
  • Set username and password to something that you will remember.
  • Configure wireless LAN with your network SSID and password. Make certain that your Wireless LAN country is poperly set as well.
  • Set local settings so your time zone and keyboard are correct.
  • Setup the persistent settings to your liking.

Click the “CHOOSE STORA…” button to select your microSD card, then click the “WRITE” button. The OS will be installed to your card. Once the verification completes and is successful, eject the card and put it in the Raspberry Pi. Start the Raspberry Pi by pressing the power button on the LiPo Amigo Pro.

SSH into the Raspberry Pi

If you don’t have PuTTY or other terminal software installed, now is a good time to head over to https://www.putty.org/ to download and install PuTTY. Once installed, open PuTTY and connect to your Raspberry Pi using the hostname that you setup when installing the OS to the card. If you cannot open a session, you may need to connect to your wireless router to determine the IP Address assigned to the Raspberry Pi and use that to connect.

Using one of the available text editors, edit /boot/config.txt. I’m using Nano, so I issued the following command. (Don’t forget sudo or you will be opening a read-only version.

sudo nano /boot/config.txt

Add the following lines at the end of /boot/config.txt, then reboot the Raspberry Pi.

# Disable Bluetooth - switch UART
dtoverlay=pi3-disable-bt

enable_uart=1

Install Hermes terminal emulator on your Psion device. On the PiRS232 board, the switches should be in the TX:TX/RX:RX and RTS:CTS/CTS:RTS positions.

NOTE TO SELF: It has been a long time since I needed to take a screenshot on a Psion device. On the 5mx, press CTRL+FN+SHIFT+S. On Windows, use an application such as XnView to open the screenshot and convert to another format.

Once the Raspberry Pi reboots and Hermes is installed on the Psion, open Hermes. On the menu, select Connection> Connection… (or Ctrl+K). Select the following options, then click the “OK” button.

  • Comms: Serial port 0
  • Baud rate: 115200
  • Settings: 8 data; 1 stop; No parity
  • Handshaking: Hardware (RTS/CTS)

If you get a dialog stating “Opening serial port Access denied”, you will need to disable the remote link.

On the System screen, open the menu and select Tools > Remote link… (or Ctrl+L).

Change the Remote Link setting to “Off”.

When connected to the Raspberry Pi, it may be necessary to press the Enter key once or twice to receive the login prompt from the Raspberry Pi.

It is now possible to work directly from the Psion or using PuTTY.

Setting up Flow Control

These commands may be entered from the Psion or PuTTY. I’m using PuTTY because it is easier to copy and paste. Issue the following commands.

sudo apt-get update

sudo apt install build-essential git
git clone https://github.com/mholling/rpirtscts 
cd rpirtscts
make
sudo ./rpirtscts on

wget https://github.com/HiassofT/AtariSIO/blob/master/contrib/rpi/uart-ctsrts.dtbo?raw=true -O uart-ctsrts.dtbo
sudo mv uart-ctsrts.dtbo /boot/overlays/

sudo nano /boot/config.txt

Add the following at the end of /boot/config.txt, then save the file and exit the Nano editor. The first, second, and the last lines should already exist from the last step, when we edited the /boot/config.txt file. We are adding the third line here.

# Disable Bluetooth - switch UART, enable CTS/RTS
dtoverlay=pi3-disable-bt
dtoverlay=uart-ctsrts
enable_uart=1

Once the file has been saved and we are back at the command line, edit ~/.bashrc file by issuing the following command.
NOTE: Kian edits ~/.bash_rc but that file did not exist and creating it and adding the line did nothing. I needed to edit ~/.bashrc instead. Editing ~/.bashrc enabled flowcontrol for my setup.

nano ~/.bashrc

Add the following line at the end of the file.

stty -F /dev/ttyAMA0 crtscts

When using PuTTY or other SSH application, you may notice that there is an error when you login that states, “stty: /dev/ttyAMA0: Permission denied”. This is not an issue and does not show on the Psion 5mx serial connection. It may be possible to edit ~/.bashrc to only execute the command that we added if there are connected over a serial connection. That will take some further investigation but is a low priority. If you know how to detect the connection type and how to change the ~/.bashrc file, please leave a comment.

Optional – Install CMatrix

CMatrix is not necessary to install but it is a good test for the serial connection and it just looks cool. From either PuTTY or the Psion, issue the following commands to install and run CMatrix.

sudo apt-get install cmatrix

cmatrix

CMatrix runs slow on the Psion 5mx with a serial connection but it works. To exit, press Ctrl+C.

Setting Up Point-to-Point Protocol (PPP)

If you have not already, please read Kian’s PPP setup and understand the security concerns and understand that the serial terminal will no longer be available after this step.

Run the following commands from PuTTY.

sudo apt install ppp

sudo nano /etc/rc.local

Add the following two lines to /etc/rc.local before “exit 0”, save the file, and exit the editor.

stty -F /dev/ttyAMA0 raw
sudo pppd /dev/ttyAMA0 115200 10.0.0.1:10.0.0.2 proxyarp local noauth nodetach dump crtscts passive persist maxfail 0 holdoff 1 &

Start raspi-config by issuing the following command.

sudo raspi-config

When Raspberry Pi Software Configuration Tool launches, go to Interface Options > Serial Port. Select “No” for shell and “Yes” for enabled.

Verify that the confirmation message states that the serial login shell is disabled and that the serial interface is enabled.

If the configuration is correct, select finish to exit and reboot the Raspberry Pi.

Setting Up the Psion

Jump over to Kian’s instructions.

I ran into an issue when attempting to connect to the internet. Hermes would not connect.

The issue turned out to be quite obvious once it dawned on me that telnet server does not exist on the Raspberry Pi. There is a good reason that it is not installed. Telnet is a security concern as it is unencrypted. Keep this in mind if you install telnet on your Raspberry Pi. To install telnet, run the following command.

sudo apt-get install telnetd

Once telnet server was installed, things worked as Kian has in his blog post.

Web Browsing

Opera is the best web browser for Psion devices, but it has only a 30-day demo. You need a license to use it past 30 days. It can be downloaded from https://get.geo.opera.com/pub/opera/. It looks like the latest version (19 April 2002) is at https://get.geo.opera.com/pub/opera/symbian/514/en/er5/.

Well, I hit another snag. It appears that I cannot connect to the internet through the Raspberry Pi. DNS was not resolving domain names, so I attempted to browse by IP Address but that did not work either.

To fix this issue, we need to do a bit more configuring on the Raspberry Pi. I found a couple of posts that helped me figure out how to fix the issue.
SOURCE: https://www.instructables.com/Connect-the-Raspberry-Pi-to-network-using-UART/ and https://www.ducea.com/2006/08/01/how-to-enable-ip-forwarding-in-linux/

The following two commands are a temporary way to get it all working.

sudo sysctl -w net.ipv4.ip_forward=1

sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

A more permanent solution is to edit /etc/sysctrl.conf and /etc/rc.local. First edit /etc/sysctrl.conf by using the following command.

sudo nano /etc/sysctl.conf

Find the commented line “#net.ipv4.ip_forward=1” and uncomment it, save the file, and exit the editor.

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

Next edit /etc/sysctrl.conf by using the following command.

sudo nano /etc/rc.local

Add the following line before “exit 0”, then save the file and close the editor.

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Reboot the Raspberry Pi. Once the Raspberry Pi reboots, attempt to browse the internet on the Psion.

Closing Up the Case

Now that the software is in working order, we can put everything in the case and close it up. First start by carefully placing the stack in the case. It is a bit of a challenge to get the standoff into case without breaking the case but it will go, you just need to be careful.

The standoffs don’t protrude through the bottom, so no worries that it will scratch the table. 😉

The DB9 screw did not hit the Pimoroni LiPo Amigo Pro, so I was able to put it back on, then I installed the Pimoroni LiPo Amigo Pro on its self by attaching it with one M2.5 5mm screw.

Installed the battery and taped down the wires so they were not in the way of the switch.

Now close it up by attaching the lid with the M3 screws. I used a bit of tape to keep the button in place while I put it all together.

Categories
Desktop Application Development Raspberry Pi Software Development

Soft Latching Power Switch Revisited

This week, I have some updates revolving around the Soft Latching Power Switch, that I last wrote about eight years ago. I finally returned to the project and now have it working as I intended. I also have made some changes to the Dual Volt Amp Meter‘s Desktop software. I believe I may now have a stable usable version. Lastly, I’ve gotten started with Flux.ai and plan on using it to replace my old version of Eagle.

Soft Latching Power Switch

Soft Latching Switch on the bench
Soft Latching Switch on the bench connected to a Raspberry Pi Zero

I resolved a few items that I encountered previously when I attempted to use the Soft Latching Power Switch designed by Mosaic Industries to control an Adafruit 1000C. I was able to reliably control the PowerBoost 1000C using the Soft Latching circuit, one I removed R13 from the PowerBoost and placed a 200K ohm resistor between the enable and ground. R13 pulls up the enable pin to Vs so that the PowerBoost is always on, unless the enable pin is connected to ground. In my case, I wanted the opposite behavior. I wanted the PowerBoost to always be off unless the enable pin is connected to Vs.

The Soft Latching Power Switch designed by Mosaic Industries is intended to switch the 5V going into the Raspberry Pi but I wanted to use it differently by having it control turn off, or disable, the PowerBoost 1000C boost circuit. Below is a diagram showing the circuit used in this design.

Complete Circuit Diagram
Complete Circuit Diagram with the Soft Latching Circuit, Powerboost 1000C, and Raspberry Pi

The Soft Latching Power Switch is connected so that the input voltage is the Vs output of the Adafruit 1000C. The Vs output is USB voltage if USB Power is applied. If USB Power is not applied, Vs is the battery voltage. The output of the Soft Latching Power Switch output is connected to the enable pin of the Adafruit 1000C. The final connection of the Soft Latching Power Switch is the control pin, which is connected to GPIO22 (pin 15) of the Raspberry Pi.

The Adfruit PowerBoost 1000C is modified by removing the 200K ohm pull-up resistor, R13. An external 200K ohm resistor is connected between the enable pin and ground. A capacitor, around 0.01uF is placed in parallel with the resistor to prevent the PowerBoost from turning on the first time power is applied from either USB or battery. The value of the capacitor used is not critical. The first capacitor I grabbed was 0.01uF and it worked. The purpose of the capacitor is to make it look like a short from the enable pin to ground when power is first applied. If you find that it still starts from the on state rather than off state, you may need to use a higher value capacitor to provide more time for the capacitor to charge up and appear as a short to ground.

Once the circuit is put together and connected, you will need to load some scripts on the Raspberry Pi to allow the switch to shutdown the Raspberry Pi when the switch is pressed and for the Raspberry Pi to turn off the power when it shuts down. The scripts are available in the Pi-Power-Button project on GitHub.

This setup provides the following functionality:

  • Button press to turn on
  • Button press to signal to the device to shutdown
  • Long button press to force power off
  • Turn off power when the Raspberry Pi shuts down

Next Steps

  • Clean up the code now that it is working as expected
  • Possibly have one script file to handle shutdown and listening for button press
  • Design another circuit to allow similar functionality from a keyboard similar to the functionality on the HP 95lx and Psion 5 PDAs

Dual Volt Amp Meter

Made some changes on the desktop application for the Dual Volt Amp Meter project that I wrote about a few weeks ago.

I was having some issues with the software after it was running for a few hours. I would get random errors related to an index being out of bounds and could not figure out how that was possible when I am in a for loop that has the lower bound being zero and the upper bound being one less than the count of items in the list. I neglected to connect the dots that I was manipulating the list in another thread to limit the number of items in the list. The error would crop up if the timing was just right that the check on the array bounds occurred on the main thread, then the code then removed the item on the other thread. The next line in my main thread then referenced the item that was just removed, then the application would crash.

I believe I have now resolved all of those issues, so the code should be stable now. It has been running for a couple of hours so far without any issues.

Below is a capture from the application showing the button on the Soft Latching Power Switch being pressed and turning on the PowerBoost 1000C and in turn, the Raspberry Pi.

Graph from from the Dual Voltage Amp Meter
Graph from from the Dual Voltage Amp Meter showing the Soft Latching Power Switch being turned on.

Flux.ai

I discovered Flux.ai by watching a hackster.io video, where Alex Glow interviewed the Flux.ai team. I have since started working with Flux.ai and intend to create the Soft Latching Power Switch publicly in Flux.ai so others may use in their designs.

I really like what the Flux.ai has put together but it feels like there is much work to do to make it a product that may be used by the community. I plan to work more with Flux.ai and provide feedback to the team on design changes that may help users come up to speed quickly.

The only Schematic and PCB Layout tool that I have used successfully was Eagle. Once Eagle was acquired by Autodesk and moved to online subscription based licensing, I stopped updating Eagle. I’m still using Eagle 7.7.0 and would like to move on to something else. I have looked at KiCad and have it installed but have not made the commitment to start using it. Part of the reason is I have several components that I built in Eagle. I would need to start over in KiCad.

Another reason I have not moved to KiCad but am willing to move to Flux.ai, has to do with the parts libraries when sharing a project. I have received or pulled KiCad designs and have had to reach out to the authors to get some missing libraries. (The same is an issue with sharing Eagle designs.) Flux.ai solves this problem as libraries are online and may be shared with the community.

In addition to public parts, Flux.ai has the ability to create pull completed circuits with PCB layouts in other designs. This is great as one may design a power supply or other circuit and pull it in and reuse it in multiple projects. I have attempted something similar in Eagle but there are always issues with it and it seems you are always reinventing the wheel. Flux.ai eliminates redundant work and speeds up the design process.

Another advantage of Flux.ai is they have brought change management into the tool. You may see all the revisions made to a part or circuit, stay on an older version, or update to the latest change. This allows someone to update their public design to fix an issue and someone else who has used the design, may pull the latest fix into their design. It also allows someone to fork someone else’s design, improve upon it, then submit a pull request so the original designer can pull the change and everyone may benefit.

As you can tell, I’m very hopeful that Flux.ai will succeed and the Open Source community will embrace what Flux.ai is attempting to do with their hardware design platform. Give it a try. I hope to see the community help Flux.ai grow.

You may see what I’m up to on the platform by going to https://www.flux.ai/richteel. So far, I’ve put together one part for the IRF7319. I did so by forking another user’s part for the IRF7317.

Categories
Uncategorized

Psion Nostalgia

QUOTE – NOSTALGIA IS HEROIN FOR OLD PEOPLE

DARA O’BRIAIN

It seems that my Psion collection has been taking most of my attention. I’ve been testing some CF, SD, and microSD cards in my Psion 5mx and Ericsson MC 218. I also came across Kian Ryan’s Sidecar for Psion devices to connect them to the internet.

I had a similar idea to Kian’s Sidecar project but instead of an RS232 connection, I was thinking of an IrDA connection. I’ve purchased the items to build Kian’s Sidecar and plan to make one once all the parts arrive. Once I get that working, I plan to design and build an IrDA version. If all goes well, I plan to sharing it with the community. I think that an IrDA version would be much nicer as it would not require carrying a serial cable.

I’ve also purchased some 2GB CF, SD, and microSD cards as well as adapters so I could test them in my Psion 5mx and Ericsson MC 218. At first they seemed to not work, then I came across a video from Handheld Computing titled, “Formatting and Partitioning Compact Flash Cards for Psion“. The video is a bit too quick in key parts but slowing the video down and pausing it in key areas led me to a solution to get the cards working on the Psion devices.

Steps to format CF, SD, or microSD cards to work in a Psion PDA. Below are a few key takeaways of what needs to be done.

  • No partitions over 2GB
  • Format using FAT 16, not FAT32
  • Max cluster size is 32 KB
  • There must be some unallocated space on the disk. 1 MB is enough.

Below are some steps using Microsoft Windows and Mini Tools Partition Wizard software.

  • If you have not downloaded and installed Mini Tools Partition Wizard or similar tool, install the software first. Mini Tools Partition Wizard is free and available at https://www.minitool.com.
  • Launch the partitioning software, accept the Windows User Account Control prompt, then locate the flash card in the list of drives.
Screen capture of Mini Tool Partition Wizard
  • Right-click on the drive and select “Delete” from the context menu
Screen capture of Mini Tool Partition Wizard
  • Click the “Apply” button to make the changes
Screen capture of Mini Tool Partition Wizard
  • Right-click on the drive and select “Create” from the context menu or click “Create Partition” in the left side panel
Screen capture of Mini Tool Partition Wizard
  • Edit the following items
    • Make certain that the “Partition Align to” is set to MB
    • File System: FAT
    • Cluster Size 32 KB
    • Reduce the Partition Size by 1 MB so that Unallocated Space After is 1 MB
    • Optionally, set the Partition Label
  • Once the values have been changed, click the “OK” button
Screen capture of Mini Tool Partition Wizard
  • Click the “Apply” button to apply the changes
Screen capture of Mini Tool Partition Wizard
  • Close the software and insert the card into the Psion. If using a SD or microSD card, you will need to use a CF adapter.
  • The Psion should recognize the card.

If you see “Disk not present” or “Corrupt”, it is possible that the card will not be usable in the Psion. If you are using a SD or microSD card, it may be worth trying a different adapter. The good news is that every card I tested worked just fine after following the above process.

I did have an issue with a microSD to CF adapter but I was not surprised as it has a WiFi module in it. Most likely it was pulling more power than the Psion could deliver, which made it unusable. I had anticipated that but wanted to give it a try.

Below is a table showing the cards that I tried and a note if they worked or not. The cards names link to the Amazon product page.

CardCapacityTypeStatus
Lerdisk microSD2GBmicroSDWorking
LILIWELL CF2GBCFWorking
QUMOX CF Adapter Reader for SDAdapterWorking
QUMOX Memory Card Adapter for Micro SDAdapterNot working
SanDisk microSD2GBmicroSDWorking
Transcend CF2GBCFWorking
Verbatim CF2GBCFWorking

Categories
Product Review Psion Repair

Updates for the week of 26 February 2023

There are many topics this week to cover, thus the reason for the non-descript title. Some of the things that have come up this week are Psion and Ericsson repairs, ChatGPT and DeepSource, and Agile2023.

Psion and Ericsson repairs

I was able to carryout another screen cable repair this week on the Ericsson MC 218. The MC 218 had the hooks in the back for the lid hinge so this repair resulted in a good as new repair. It did pose a challenge as the hinge is really not designed to be put in place while connected to the screen. I feared that I was going to break the plastic hooks so I worked to remove the pins holding the wire hinge from the screen. It was not easy and after I removed them, I saw that doing so caused a different challenge. The pins holding the wire hinges in place are actually spring metal wound up into a pin shape. This made them difficult to put back into place. The removal of the pins did make it much easier to get the wire hinges over the plastic hooks without breaking them, but I do not recommend doing that. If I carry out this repair again in the future, I plan to figure a better way to choregraph putting it all back together without breaking the hooks.

I feel that the terminology that I’m using to describe the hinge mechanism on the Psion 5 Series devices is not correct. If Martin Riddiford or anyone else in the know happens across this post, please add a comment below to let us know what the proper names for these are. Also a drawing with text pointing to them would be awesome as well.

I captured a video of the repair and hope to find some time shortly to edit it and post it to YouTube. I will post an update with a link to the video once it is available. In the meantime, here are some screen grabs from some of the video to show the hinge assembly and the spring metal pins referenced above.

Screen with annotation for hinge wires and sprint metal pins
Screen with showing wire hinges and spring metal pins.
Unit with annotation pointing to one of two hinge hooks
Unit with showing one of the two hinge hooks.
A view of the other hinge hook
A view of the other hinge hook.
Disassembled unit with annotation pointing to other hinge hook.
Another view of the hinge hook.

Hinge Repair

The hinge repair that I carried out last week, did not last long, which was not too much of a surprise. The metal pins bent and allowed the hinges to pop out from under the cover. I straightened the pins and used my 3Doodler, to add some PLA around the pins to give them a bit more strength so they hopefully will last a bit longer. The repair looked ugly but no one will see how bad I am at using the 3Doodler.

The opening and closing of the unit is very tight after the repair, which makes me a bit uncomfortable so I will take it easy when opening and closing the unit.

Hinge repair before and after
Hinge repair before and after
Hinge repair before and after
Hinge repair before and after for the other side

ChatGPT and DeepSource

It looks like things may be starting to really take off in the Artificial Intelligence (AI) field. We are starting to see more and more application of AI in some of the products that we use. I had been following the latest news regarding ChatGPT and found it interesting that it was able to pass a law exam at two different universities. While it would not be at the head of the class, it is good enough to get a passing grade. This presents a lot of challenges for professors at universities.

I had not given it much thought until I saw a video, 10X Your Code with ChatGPT: How to Use it Effectively, by Dave Plummer showing how ChatGPT could be used by software developers and others. He showed how he was able to interact with ChatGPT to develop a small software application and how we all need to start to understanding how to use the tool in our workflows.

I have seen that Visual Studio is now prompting me with code completion, based on my previous actions and where I’m at in the code. It is kind of freaky seeing the IDE basically writing code for you. There were times that it seemed to get in the way but most of the time, it was a real time saver. I’m sure it will get even better in the near future.

We may be at at point in time when AI will really start to have an impact in how we work and in our daily lives. Let’s just say that it has my attention now.

DeepSource

As I was trying ChatGPT, one very good use case popped out, and that is to do code reviews. Typically I am a lone developer and one of the biggest disadvantages of being a lone developer is your code is rarely code reviewed by anyone. ChatGPT did a fairly good job but the length of code it can code review is very limited.

Looking into ChatGPT led me to look into tools for Code Review. I found an article at GeekFlare, 6 Best Automated Code Review Tools for Developers. The article listed DeepSource as number 3. I looked into the other options and settled on DeepSource. It has great integration with GitHub so it scans code each time it is checked in. I was able to clean up my code fairly quickly.

I’ve made a recommendation to the DeepSource Team to incorporate AI for code reviews, particularly for us lone developers. We may be a few years away from being able to have a really good AI performing code reviews, but I think that is something we will see in the very near future.

Agile2023

I received some news this week that my submission for the Agile2023 conference was accepted. Now, I need to focus on polishing and practicing the workshop. This will be my first time presenting at a conference, so I’m nervous and excited for the opportunity. I hope it goes well and starts me down a path for the future.

Categories
Psion Repair

Fix-It Week

I’ve had a busy week fixing items that have broken or that I bought on eBay that were for parts only.

Air Fryer

Air fryer

The Air Fryer, that we purchased on Amazon in March 2021 broke after 1 year and 10 months of service. At first, it would not shut off when the handle was lifted but after bumping it once, it shut off an would not come back on. I tool it apart to see if it could be repaired and found that the microswitch that turns the unit on when the handle is moved, failed. I was able to order a new one and replace it. It is working once again. Hopefully it will last a bit longer this time.

Curiosity got the best of me and I cracked open the microswitch to see how it failed as the failure seemed odd. The plunger on the switch was loose and I was not expecting that from a failed microswitch. Once it was cracked open, I could see that apparently the contacts had welded shut and created a lot of heat, which melted the plastic. It was a combination of these things that made it fail the way it did.

Microswitch cut open
Switch cut open showing how it failed.
Microswitch cut open showing melted plastic
Switch cut open with most internals removed to show melted plastic.

If interested, here are the links to the Amazon product pages for the Air Fryer and the replacement switch.

eBay purchases of Psion PDAs for parts

Phot from eBay auction with 4 Psion PDA devices.

I have an obsession for the old Psion PDAs and have an unhealthy collection of them. Lately I made a purchase of a lot with four defective Psion devices. The idea is if I can’t fix them, I should at least be able to repurpose the keyboard for some future project. (I’m also doing the same with the HP 95lx devices.)

Diamond Mako Revos

The lot of four Psion devices now has three functional units. I first worked on the Diamond Mako Revo devices. One unit was disassembled and the other one worked but needed to be plugged in as it no longer held a charge. I took to Amazon and purchased 4 Ni-MH AAA batteries with solder tabs. I was able to get both units working by replacing the batteries. I did have to use some hot glue to reenforce the lower pins holding the back cover in place. They seem to be brittle on both sides. A bit of carefully placed hot glue seemed to be enough to hold them in place.

Photo showing where the lower pin on the spring was cracked on the Psion Revos.
The circle shows where the lower pin on the spring was cracked on the both Revos.

I had another issue with the devices. At first, they did not seem to want to stay powered on even though they were plugged into the power supply. I could not figure out why the units would not stay on, so I started looking at them very carefully. I had discovered that the negative terminal in the battery connector had bent over and was touching the temperature sensor pin. It was not easy but I was able to straighten the pin and pulled the wire from the plug to make certain that it was fine. I carefully plugged the battery back in and they worked as expected.

What made this easier to figure out what was going on was by using the test points on the board. I was able to tell that the negative voltage was not where it should be, which led me to look closely at the plug and jack for the battery connection.

Photo showing the test points on the battery PCB
The test points on the battery PCB showing where the battery voltage should be present when all is connected as it should be.

David Savery’s post from 2004, on R3UK titled, Psion Revo/Diamond Mako Disassembly & Battery Replacement, was a big help in replacing the batteries in the Revos.

The two repaired Revos
The two repaired Revos now hold a charge and live on once again.

Below is the link to the batteries on Amazon.

Psion 5MX

The Psion 5MX and the Erickson MC 218, both had broken display cables, which is a common failure for Psion 5MX devices. I was able to order some replacement cables from Psionex. Nick and Rudy at Psionex were real helpful when I contacted them to verify that the Erikson MC 218 used the same screen cables as the Psion 5MX. I was surprised at how quickly they responded. It was late on this side of the pond so I did not expect a response from anyone until the next day but within an hour or two from submitting the contact request form, they got back to me.

Once again, David Savery had a post that was a big help. The post from 2004 is titled, Psion Series 5MX disassembly and screen cable repair.

The Psion 5MX that I received from eBay was in rough shape but I powered it on and I found that it had an issue with the screen cable, just like the Ericson. Since it was in the worst shape, I decided to disassemble it first as a practice run.

All went well and I was able to take the unit apart and replace the cable. I did find that it was easier to cut the ribbon cable to separate the touch screen controller before attempting to unsolder the cable. I thought using my hot air soldering station would be quicker but right away, I saw it melted some of the tape and other things around the screen so I just used my soldering iron. It was not too bad to remove and solder the new cable in place.

Fortunately, I was so concerned that things did not go well that I connected everything on the bench before reassembling the unit. I found that even though I measured the resistance on the touch screen connection, something was not right. The screen was spot on though so I was happy about that. It was a bit tricky but I was able to reflow the solder on the touch sensor connections and when I tested again, everything was in working order.

I started reassembling the unit and thought that the hinges seemed to be off, but I could not determine what the problem was. When it was finally all reassembled, the wire hinges popped out from under the rear cover. I then went back to Dave Savery’s page and finally saw that there were supposed to be hooks to keep them in place. I had to think of something so I used some leads from resistors that I had saved and melted them into the plastic and formed some hooks to keep the hinges in place. Hopefully that is enough to keep them in place as long as I use it. We shall see but it looks fine for now.

Photo with the hinge hook circled
One of the hooks that were missing on my unit.
Broken Ericson MC218 and the repaired Psion 5MX
On the left is the defective Ericsson MC 218 and on the right is the repaired Psion 5MX.

The repaired Psion 5MX is now my spare unit as the hinge repair job is not perfect. There is now some play in the unit so it does not close tightly. The keyboard and screen flop around by about 1/8″ (3 mm).

Below is a link to the Cables on Psionex. I’m not certain how much longer they will be in stock, but I will be reaching out to them again if I’m in need of any more. I’m including the link to the Series 5 cable as well.