Got a delivery today …
Woot .. let the 8088/v20 hardware hacking commence!
First to do: LEDs, everybody loves blinking leds.
Next: Probably a address decoder with a VIA/CIA and a LCD Display.
Now I have to wait for my mouser order to be delivered.
Got a delivery today …
Woot .. let the 8088/v20 hardware hacking commence!
First to do: LEDs, everybody loves blinking leds.
Next: Probably a address decoder with a VIA/CIA and a LCD Display.
Now I have to wait for my mouser order to be delivered.
Started drawing a Cassette interface in Kicad.
This so i can read back my old cassettes with programs.
(And write some new stuff)
I’m planning to buy a small micro cassette player.
With schematic below, I’m going to use it as save/load device.
But also with the same player, I’m going to convert the tape to a wave file, and try to decode the program using python.
While I’m at it, reading the old manuals, a RS-232 interface would be nice also!
UPDATE 20231016
This is the final version
Information about the 7655A.
A eprom WITH IO ports! Amazing piece of history hardware.
Testing some sims on Linux and Android
While working on my game, i had to come up with some solutions i could not find an answer for on the internet.
I’m not going to post every little detail of my game on this blog, my main reason is sharing my experiences and solutions.
16 SWITCHES
16 Switches on a Wemos Arduino. While push buttons are easier to connect, I needed ON/OFF switches.
Push buttons are easy, there is only one active, so 4 enable lines and 4 scan lines and you’re golden.
16 Switches can be enabled all at the same time.
So you need some extra components to get a good result (0-65535)
Above schematic works, you need 4x 1k Pull-up resistors and 16 diodes. I used 1N4007
CONTROLLING 24V using Arduino and a buck convertor
Next problem, i’m using some elevator buttons for a project. These have build-in leds but run at 24V.
I only have 5V from the Arduino.
Regular leds you can connect directly to the Arduino using a 220ohm resistor.
So i used a Buck-Step-Up-Convertor. This little module converts 5V to 24V. (You can control the output voltage using a variable resistor)
To control the lamp/leds i used a PN2222a transistor to switch the lights on/off using a pin of the Arduino.
UPDATE: 20230214 / 20230224
Install Bullseye on a SDCard
Enable wifi country code using raspi-conf
(While you at it, enable I2C for the display)
Install and configure an Access Point
# As root apt update apt upgrade apt install hostapd apt install dnsmasq systemctl stop hostapd systemctl stop dnsmasq cat <<EOF > /etc/hostapd/hostapd.conf interface=wlan0 driver=nl80211 ssid=escape hw_mode=g channel=6 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=mysecretpass wpa_key_mgmt=WPA-PSK rsn_pairwise=CCMP EOF cat <<EOF >> /etc/dnsmasq.conf interface=wlan0 bind-dynamic domain-needed bogus-priv dhcp-range=192.168.50.150,192.168.50.200,255.255.255.0,12h EOF cat <<EOF >> /etc/dhcpcd.conf interface wlan0 nohook wpa_supplicant static ip_address=192.168.50.10/24 static routers=192.168.50.1 static domain_name_servers=8.8.8.8 EOF sed -i s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g /etc/sysctl.conf mkdir /etc/nftables cat <<EOF > /etc/nftables/nft-stat-ap.nft flush ruleset table inet ap { chain routethrough { type nat hook postrouting priority filter; policy accept; oifname "eth0" masquerade } chain fward { type filter hook forward priority filter; policy accept; iifname "eth0" oifname "wlan0" ct state established,related accept iifname "wlan0" oifname "eth0" accept } } EOF chmod +x /etc/nftables/nft-stat-ap.nft cat /etc/nftables.conf | grep nft-stat-ap.nft || echo 'include "/etc/nftables/nft-stat-ap.nft"' >> /etc/nftables.conf systemctl unmask hostapd systemctl enable hostapd systemctl enable nftables reboot
UPDATE: 20230214
Now in its case, added two buttons and one led.
UPDATE : 20230224 mqtt config
apt-get install mosquitto mosquitto-clients vi /etc/mosquitto/conf.d/remotemqtt.conf per_listener_settings true # internal mqtt listener 1883 allow_anonymous true # connection over the internet connection bridge-01 address remoteserver:8883 bridge_cafile /etc/mosquitto/certs/ca.crt bridge_keyfile /etc/mosquitto/certs/remoteaccesspoint.key bridge_certfile /etc/mosquitto/certs/remoteaccesspoint.crt topic escape/# both 0 remote_username remoteuser remote_password remotepass ########## remote server config cd /etc/mosquitto mosquitto_passwd passwords remoteuser cd /etc/mosquitto/certs ./generate-CA.sh client remoteaccesspoint copy ca.crt remoteaccesspoint.key and remoteaccesspoint.crt to accesspoint mosquitto.conf pid_file /var/run/mosquitto.pid persistence true persistence_location /var/lib/mosquitto/ #per_listener_settings true # Plain MQTT protocol listener 1883 allow_anonymous true # End of plain MQTT configuration # MQTT over TLS/SSL listener 8883 cafile /etc/mosquitto/certs/ca.crt certfile /etc/mosquitto/certs/webserver.fash.lab.crt keyfile /etc/mosquitto/certs/webserver.fash.lab.key allow_anonymous false password_file /etc/mosquitto/passwords # End of MQTT over TLS/SLL configuration listener 9001 protocol websockets # End of plain Websockets configuration # WebSockets over TLS/SSL listener 9883 protocol websockets cafile /etc/mosquitto/certs/ca.crt certfile /etc/mosquitto/certs/webserver.fash.lab.crt keyfile /etc/mosquitto/certs/webserver.fash.lab.key log_dest file /var/log/mosquitto/mosquitto.log include_dir /etc/mosquitto/conf.d connection bridge-01 address extramqttserver:1883 topic lscspm1/# both 0 topic owntracks/# both 0 topic escape/# both 0 log_type all
Controlling Display and MQTT messages examples
apt-get install python3-smbus python3 printline.py -1 "line 1" -2 "line 2" wget https://github.com/emcniece/rpi-lcd/blob/master/RPi_I2C_driver.py cat printline.py # requires RPi_I2C_driver.py import RPi_I2C_driver from time import * import sys, getopt #python3 fix unichr = chr mylcd = RPi_I2C_driver.lcd() # test 2 1234567812345678 def main(argv): line1 = '' line2 = '' try: opts, args = getopt.getopt(argv,"h1:2:",["txt1=","txt2="]) except getopt.GetoptError: print ('printline.py -1 <line1> -2 <line2>') sys.exit(2) for opt, arg in opts: if opt == '-h': print ('printline.py -1 <line1> -2 <line2>') sys.exit() elif opt in ("-1", "--txt1"): line1 = arg elif opt in ("-2", "--txt2"): line2 = arg mylcd.lcd_display_string(line1, 1) mylcd.lcd_display_string(line2, 2) if __name__ == "__main__": main(sys.argv[1:])
Print internal and external ip
myip=$(/usr/sbin/ifconfig eth0 | grep "inet " | awk '{ print $2 }') extip=$(curl -s http://whatismyip.akamai.com/) python3 printline.py -1 "i $myip" -2 "e $extip"
mosquitto health tester
timeout 1 mosquitto_sub -t '$SYS/#' -C 1 | grep -v Error || exit 1
Button press shutdown
raspi-gpio get 27 | grep level=0 >/dev/null if [ $? == 0 ] ; then python3 printline.py -1 "shutting" -2 "down" /usr/sbin/halt -p fi
Cleaned-up minimal mqtt poster
#include <WiFi.h> #include <PubSubClient.h> const char* ssid = "ssidname"; const char* password = "ssidpass"; const char* mqttServer = "192.168.50.10"; WiFiClient espClient; PubSubClient client(espClient); void initWiFi() { WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); Serial.print("Connecting to WiFi .."); while (WiFi.status() != WL_CONNECTED) { Serial.print('.'); delay(1000); } Serial.println(WiFi.localIP()); } void setup() { Serial.begin(115200); initWiFi(); Serial.print("RRSI: "); Serial.println(WiFi.RSSI()); client.setClient(espClient); client.setServer(mqttServer,1883); if (client.connect("testmodule")) { Serial.println("connected"); client.publish("escape/testclient", "connected"); } else { Serial.println("Mqtt not connected"); } } void loop() { } }
As mentioned in post below
Update: https://www.henriaanstoot.nl/2023/01/17/arduino-concertina-poc-2/
So i’ve bought some needed parts and made a proof of concept.
Arduino Code
Needs https://playground.arduino.cc/Code/Keypad/ keypad library
Not all buttons are configured with frequencies … yet
#include <Keypad.h> int buzzer=9; int lastsensorread; int prevkey; int push=400; int pull=600; const byte ROWS = 8; //four rows const byte COLS = 3; //three columns char keys[ROWS][COLS] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'#','0','*'}, {'A','B','C'}, {'D','E','F'}, {'G','H','I'}, {'J','K','L'} }; byte rowPins[ROWS] = {5, 6, 7, 8, 10, 11, 12, 13}; //connect to the row pinouts of the keypad byte colPins[COLS] = {2, 3, 4 }; //connect to the column pinouts of the keypad Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS ); void setup(){ Serial.begin(9600); pinMode(buzzer,OUTPUT); } void loop(){ char key = keypad.getKey(); // if (key == NO_KEY){ // key = prevkey; // } // if (key != NO_KEY){ int freq = 0; int sensorValue = analogRead(A0); //sensorValue = ((sensorValue+4)/5)*5; if (sensorValue > push && sensorValue < pull ) { // Serial.println("No pull or push"); noTone(buzzer); } else { if (key == '1' && sensorValue < push ) { tone(buzzer,415); }; // G push if (key == '1' && sensorValue > pull ) { tone(buzzer,466); }; // A pull if (key == '2' && sensorValue < push ) { tone(buzzer,392); }; // G push if (key == '2' && sensorValue > pull ) { tone(buzzer,440); }; // A pull if (key == '3' && sensorValue < push ) { tone(buzzer,587); }; // G push if (key == '3' && sensorValue > pull ) { tone(buzzer,659); }; // A pull if (key == '4' && sensorValue < push ) { tone(buzzer,440); }; if (key == '4' && sensorValue > pull ) { tone(buzzer,392); }; if (key == '5' && sensorValue < push ) { tone(buzzer,329); }; if (key == '5' && sensorValue > pull ) { tone(buzzer,349); }; if (key == '6' && sensorValue < push ) { tone(buzzer,493); }; if (key == '6' && sensorValue > pull ) { tone(buzzer,523); }; //8l f/e if (key == '8' && sensorValue < push ) { tone(buzzer,261); }; if (key == '8' && sensorValue > pull ) { tone(buzzer,587); }; if (key == 'A' && sensorValue < push ) { tone(buzzer,783); }; if (key == 'A' && sensorValue > pull ) { tone(buzzer,739); }; if (key == 'B' && sensorValue < push ) { tone(buzzer,523); }; if (key == 'B' && sensorValue > pull ) { tone(buzzer,493); }; if (key == 'D' && sensorValue < push ) { tone(buzzer,987); }; if (key == 'D' && sensorValue > pull ) { tone(buzzer,880); }; if (key == 'E' && sensorValue < push ) { tone(buzzer,659); }; if (key == 'E' && sensorValue > pull ) { tone(buzzer,587); }; //tone(buzzer,freq); } Serial.println(sensorValue); Serial.println(key); Serial.println(freq); // lastsensorread = sensorValue; prevkey = key; // } }
Lets make a test holder from pieces of wood, when i’ve got the sizes correct, i’ll 3D print something
A nice book for ideas
Work document for friends
These tiny modules use a Clock and Data signal.
The rest of the pins are for 3.3V and Gnd.
There are many libraries you can choose from, i’ve tried several.
For now, i ended up with this one.
Another promising one is https://github.com/AKJ7/TM1637
Another one i’ve tested https://github.com/bxparks/AceSegment
Now i have to add Wifi and Mqtt so it can remotely controlled.
Connected like this
Code with Wifi/Mqtt
#include <Arduino.h> #include <TM1637Display.h> #include <ESP8266WiFi.h> #include <PubSubClient.h> const char* ssid = "MYSSID"; const char* password = "MYSSIDPASS"; const char* mqtt_server = "MQTT-SERVER-IP"; const int CLK = D6; //Set the CLK pin connection to the display const int DIO = D5; //Set the DIO pin connection to the display int numCounter = 0; int mydata = 0; // The amount of time (in milliseconds) between tests #define TEST_DELAY 2000 const uint8_t SEG_DONE[] = { SEG_B | SEG_C | SEG_D | SEG_E | SEG_G, // d SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O SEG_C | SEG_E | SEG_G, // n SEG_A | SEG_D | SEG_E | SEG_F | SEG_G // E }; TM1637Display display(CLK, DIO); WiFiClient espClient; PubSubClient client(espClient); unsigned long lastMsg = 0; #define MSG_BUFFER_SIZE (50) char msg[MSG_BUFFER_SIZE]; int value = 0; void setup() { display.setBrightness(0x0a); //set the diplay to maximum brightness Serial.begin(115200); setup_wifi(); client.setServer(mqtt_server, 1883); client.setCallback(callback); } void setup_wifi() { delay(10); // We start by connecting to a WiFi network Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } client.setServer(mqtt_server, 1883); client.setCallback(callback); randomSeed(micros()); Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); } void callback(char* topic, byte* payload, unsigned int length) { char buffer[4]; Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i = 0; i < length; i++) { Serial.print((char)payload[i]); buffer[i] = int(payload[i]); } Serial.println(); // mydata=int(payload[0])+int(payload[1]*10); int n; n = atoi(buffer); display.showNumberDec(n); //Display the numCounter value; } void reconnect() { // Loop until we're reconnected while (!client.connected()) { Serial.print("Attempting MQTT connection..."); // Create a random client ID String clientId = "ESP8266Client-"; clientId += String(random(0xffff), HEX); // Attempt to connect if (client.connect(clientId.c_str())) { Serial.println("connected"); // Once connected, publish an announcement... client.publish("escape/seg1ping", "seg1alive"); // ... and resubscribe client.subscribe("escape/seg1data"); } else { Serial.print("failed, rc="); Serial.print(client.state()); Serial.println(" try again in 5 seconds"); // Wait 5 seconds before retrying delay(5000); } } } void loop() { if (!client.connected()) { reconnect(); } client.loop(); unsigned long now = millis(); if (now - lastMsg > 2000) { lastMsg = now; ++value; snprintf (msg, MSG_BUFFER_SIZE, "seg1alive #%ld", value); Serial.print("Publish message: "); Serial.println(msg); client.publish("escape/seg1ping", msg); } }
Lets try to make a Electronic Concertina
UPDATE:
https://www.henriaanstoot.nl/2023/01/10/arduino-concertina-poc/
https://www.henriaanstoot.nl/2023/01/17/arduino-concertina-poc-2/
So we need some pushbuttons … at least 14 .. for the most simple tunes.
A sensor for push and pull.
A buzzer or better yet .. a jack for earphones.
Arduino with enough pins to connect a keyboard matrix.
When using a keyboard matrix only single keypresses are detected.
So we cant do chords!
I’ve been working on some modular gadgets which can be combined to make a complete puzzle.
I like games like Keep-talking-and-nobody-dies. (Which is a computer game, but you have to play it with multiple persons and a physical “manual” Great fun!)
https://keeptalkinggame.com/
And i like real escape rooms.
There are some puzzle “rooms” you can buy in the game store, it is okay but many are for single use only.
I’ve been following some people on youtube, i saw some great ideas but not a remote over the internet using physical knobs and switches.
This is a RFID reader with an old Amico Esp8266 Arduino. It sends RFID information to the MQTT broker
Some other tools ‘n knobs .. and stuff
I want to use Adhoc Wifi and a Mqtt/Nodered setup which uses a mqtt over the internet to get people (and their knobs) connected
I already got a lot of test schematics
Schematic for the MQTT enabled RFID module
ESP8266 <-> RC522
D8 SDA
D5 SCK
D7 MOSI
D6 MISO
GND GND
D1 RST
3V3 3V3
Code
Below will write the RFID id to “rfid/id” and resets this when you remove the tag to “rfid/id = 0”
#include <ESP8266WiFi.h> #include <WiFiClient.h> #include <PubSubClient.h> #include <MFRC522.h> #define SS_PIN D8 #define RST_PIN D1 MFRC522 mfrc522(SS_PIN, RST_PIN); unsigned long cardId = 0; WiFiClient net; PubSubClient client(net); const char* mqtt_server = "MQTTBROKER"; const char* ssid = "MYSSID"; const char* password = "MYWIFIPASSWD"; void setup() { SPI.begin(); mfrc522.PCD_Init(); WiFi.mode(WIFI_AP_STA); WiFi.begin(ssid, password); client.setServer(mqtt_server, 1883); } void reconnect() { while (WiFi.waitForConnectResult() != WL_CONNECTED) { WiFi.begin(ssid, password); } while (!client.connected()) { String clientId = "NodeMCUClient-"; clientId += String(random(0xffff), HEX); if (!client.connect(clientId.c_str(), "rfidclient", "...")) { delay(5000); } } } void loop() { reconnect(); if (!mfrc522.PICC_IsNewCardPresent()) { return; } if (!mfrc522.PICC_ReadCardSerial()) { return; } cardId = getCardId(); char buffer[10]; sprintf(buffer, "%lu", cardId); client.publish("rfid/id", buffer); uint8_t control = 0x00; do { control = 0; for (int i = 0; i < 3; i++) { if (!mfrc522.PICC_IsNewCardPresent()) { if (mfrc522.PICC_ReadCardSerial()) { control |= 0x16; } if (mfrc522.PICC_ReadCardSerial()) { control |= 0x16; } control += 0x1; } control += 0x4; } delay(0); } while (control == 13 || control == 14); reconnect(); client.publish("rfid/id", "0"); delay(500); mfrc522.PICC_HaltA(); mfrc522.PCD_StopCrypto1(); } unsigned long getCardId() { byte readCard[4]; for (int i = 0; i < 4; i++) { readCard[i] = mfrc522.uid.uidByte[i]; } return (unsigned long)readCard[0] << 24 | (unsigned long)readCard[1] << 16 | (unsigned long)readCard[2] << 8 | (unsigned long)readCard[3]; }
Schematics used for the Solenoid lock
Software is a mqtt example from the internet which toggles a PIN on the arduino.
UNTESTED, haven’t got all components yet!
Sometimes when i’m writing code i want to know what’s happening. For example when i’m working on the display, there is maybe no output.
With the above example i can write to address $01F0 (example address), and it will display on the 7 Segment displays.
Upperleft PLD is my address decoder, which has been running for a while now.
Secondary PLD adds the rest of the Addressbus lines, and gives me the opportunity to select in a range of 16 addresses, using jumpers/
The two smaller PLD’s latch the databus data when addressed.
AND decodes a nibble to 7-Segment output for 0-9A-F.
(There are apparently no chips available which do A-F)
I’m going to add the PLD code when everything works. Let me know if you like the idea.
Should be only a few Euro’s