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.
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
Left part of the “connect the wires puzzle” right a solenoid electrical lock)
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.
No more sync issues! (see post https://www.henriaanstoot.nl/2022/10/19/composite-video-with-atmega328p/ )
There are some duplicate characters, the input device below does not have a proper debounce method.
My temporary input device (note hex 21 is a “!” character)
No need to fix the debounce, the dipswitches are temporary. This will be controlled by the VIA 6522 chip.
UPDATE 20221108 (Connected to second VIA)
PORTB = $5000
PORTA = $5001
DDRB = $5002
DDRA = $5003
clock = $e0
E = %10000000
RW = %01000000
RS = %00000000
.org $0200
reset:
ldx #$ff
txs
lda #%11111111 ; Set all pins on port B to output
sta DDRB
lda #%10000000 ; Set top pin on port A to output
sta DDRA
lda #$00 ; reset bit
sta PORTA
sta clock
ldx #0
print:
lda message,x
beq printborder
jsr print_char
inx
jmp print
loop:
jmp loop
message:
.db 0x01,0x04,0x0C,0x0E,0x10,0x0F,0x08
.db 0x05,0x0a,0x0a
.db 0x05,0x0b,0x0b
.asc "Composite Video 6502 - 20221108"
.db 0x0E,0x11,0x0F,0x0C
.asciiz " With 2 pixels "
waitloop:
pha
tya
pha
ldy #$ff
back:
dey
bne back
pla
tay
pla
rts
print_char:
sta PORTB
jsr waitloop
jsr waitloop
lda clock
eor #%10000000
sta clock
sta PORTA
jsr waitloop
lda clock
eor #%10000000
sta PORTA
jsr waitloop
rts
Control codes as from : http://searle.x10host.com/MonitorKeyboard/index.html
Video display control codes:
Hex (Decimal) and meaning
01 (01) - Cursor home (Standard ASCII)
02 (02) - Define cursor character (2nd byte is the curs character, or 00 to turn off) <--New for 3.0
03 (03) - Cursor blinking
04 (04) - Cursor solid
05 (05) - Set graphics pixel (next two bytes = x,y) <--New for 3.0
06 (06) - Reset graphics pixel (next two bytes = x,y) <--New for 3.0
08 (08) - Backspace (Standard ASCII)
09 (09) - Tab (Standard ASCII)
0A (11) - Linefeed (Standard ASCII)
0C (12) - Clear screen (Standard ASCII)
0D (13) - Carriage return (Standard ASCII)
0E (14) - Set column 0 to 79 (2nd byte is the column number) or 0 to 39 for a 40 char line
0F (16) - Set row 0 to 24 (2nd byte is the row number)
10 (16) - Delete start of line
11 (17) - Delete to end of line
12 (18) - Delete to start of screen
13 (19) - Delete to end of screen
14 (20) - Scroll up
15 (21) - Scroll down
16 (22) - Scroll left
17 (23) - Scroll right
18 (24) - Set font attribute for the current line (see elsewhere on this page for details) <--New for 3.0
1A (26) - Treat next byte as a character (to allow PC DOS char codes 1 to 31 to be displayed on screen)
1B (27) - ESC - reserved for ANSI sequences
1C (28) - Cursor right
1D (29) - Cursor Left
1E (30) - Cursor up
1F (31) - Cursor down
20 (32) to 7E (126) - Standard ASCII codes
7F (127) - Delete
80 (128) to FF (255) - PC (DOS) extended characters