The swamp of a modified keyboard (Reiwa NeXT keyboard V2)

The swamp of a modified keyboard (Reiwa NeXT keyboard V2)

This article is the 22nd day of the advent calendar of Studio Aquatan 2023.

Hi, this is Prof. omzn (keyboard modification studies).
This is a continuation from a week ago.

Reiwa NeXT keyboard V2

Actually, I have an unmodified NeXT keyboard, but this one is junk and does not work even if it works.
I decided to modify this one, too.

The eBay price of the NeXT keyboard as of December 2023 is as shown below.

I’m so nervous about wasting it…

Now, we will realize the following three points.

  • No pattern cutting
  • Change the physical keys to compatible ones
  • Make them light up

Key layout

Similar to V1, but the Return key is inverted L-shaped, and the backslash key is pushed out to the numeric keypad.
The backslash key is pushed out to the numeric keypad.
The engraving looks like old Macintosh.

Physical keys

This keyboard uses ALPS black keys.
The ALPS axis is no longer manufactured by ALPS Electric.

Key Matrix Analysis

The matrix pattern of the original NeXT keyboard is analyzed. With a tester in hand, we follow the pattern on the back side.
This time, I will make the keyboard without cutting the pattern. We will also make a board on which Pi Pico will be placed, and fit it into the place where the original controller was removed.

The following figure shows the result of the analysis.

The keys close to each other are compactly arranged, and the matrix looks like it could fit in an 8×10… but only the modifier keys are sticking out. What’s this? If you look closely, you can see that the line marked R10 is GND. So, these keys are not matrix keys, but direct keys.

Since we are not using a microcontroller with that many pins, we integrate the modifier keys into the matrix by following the GND pattern and removing the jumper from GND to make it a single bus.
The final matrix is as follows. The modifier is integrated in the rows and columns for the convenience of the Pi Pico board.

We will make a board to convert this matrix to Pi Pico. This is very convenient because the modifier keys can be integrated only on this board.


After designing the board, I ordered it from Elecrow. The cost of the board is $1.00. Shipping is about $15 and it takes less than a week. I decided that it would be better to solve the problem with money than to try hard to arrange the line where the bug would enter.

Mounting

I looked around for a way to make the LEDs glow from behind the keys, but in the end I decided to replace all the switches.

The board has a single-sided pattern, so it is easy to remove the solder.
However, the copper foil pattern itself is brittle and easily peels off since it is an old board.
With great care, we removed the solder and the switches.

Remove…

Remove…

Remove…

Voila!

I got Matias Click Switch Gray and White from FILCO Direct. Only the numeric keypad is made to click with White.

The jumper on the surface of the switch will be removed and re-mounted on the back side of the switch, because the LED strip will be in the way.
The consumption speed of the desoldering wire is extraordinary.
In the end, I had to remove more than 90% of the mounted parts.

In addition, the Caps Lock LED is changed to a white LED.

Next, I installed LED strips to make the LEDs shine. 10mm wide LED strips are commonly used, but they seem to interfere with the keyswitch (just barely), so I got 5mm wide ones this time.

First row…

2nd row…

All rows…

Lit!

This is the end of the work on the board, so let’s solder the keyswitch.
Once the keyswitch is soldered, the LED strip cannot be touched, so it is necessary to double-check for poor contact.

Finishing

When I finished soldering the keyswitches, the key matrix conversion board arrived from Shenzhen.



Connectors for I2C and WS2812 were also pulled out.
This is used to bridge the Raspberry Pi Pico and the keyboard board.
As long as there are no bugs on the board, the wiring work can be completed without connecting a single wire.

Test lighting! Good!

The transparent OLED is also attached via I2C.
This is exactly the same as V1, so it is easy to do.

All that is left is to assemble it.

Completed!

It’s done!


The code of QMK is available in GitHub.

Bugs and failures along the way

  • At first, I misunderstood how to light the LEDs on the main board, and thought the 5V line was GND. I made the first conversion board as it was, so I had to do a major re-do and ended up reordering.
  • After installing the LED strips and soldering all the keyswitches, I did a key matrix test and found that one line was unresponsive. The tester found that only when the LED strip was connected, 5V was connected to the line in question. This was because when the jumper wire was replaced, a small portion of the jumper wire was in contact with the 5V of the LED strip.

Conclusion

It is fun to revive old keyboards by modifying them.
In particular, keyboards with mechanical switches from the 1990s are worth reviving because they have a good feel when you hit the keys.

If you find a good keyboard in a junk shop, you can get it immediately!

Merry Christmas and a happy new year!

The way to a modified keyboard (Reiwa NeXT keyboard V1)

The way to a modified keyboard (Reiwa NeXT keyboard V1)

This article is the 15th day of the advent calendar of Studio Aquatan 2023.

This is Prof. omzn (keyboard modification studies).

Heisei Version of the NeXT Keyboard

When I was still young, in the 2000s, I enjoyed modifying old computers to convert them into the latest PCs.
I modified NeXT cube, NeXT station, Macintosh LC II (I think), Mac G4 cube, etc. to make a mini PC.
Despite all the hard work, we produced a terrible machine that could not deliver much performance, and would run out of control quickly because of its broken thermal design.
I feel bad for the old computers that were sacrificed.

The NeXT keyboard was something like a Mac-style ADB, but at the time it was just a useless keyboard.
Then, young omzn had a flash of inspiration.


“I think I can get a controller from a junk PS/2 keyboard lying around here and port it to the NeXT keyboard.”

He immediately investigated the keyboard mechanism, and found that the keyboard had a key matrix decoder on it, and, unfortunately, the key matrices were all different.

“I want to make the most of this PS/2 keyboard I’ve taken apart…”

Here, omzn had another flash of inspiration.

“I see, I can rewire the NeXT side to fit this PS/2 keyboard.”

Thus was born the Heisei version of the NeXT keyboard.



I thought it would be OK to use PS/2, which was the standard at the time, but the era soon gave way to USB, and the NeXT keyboard was used for nearly 20 years with the USB conversion. However, because it was originally a PC/AT keyboard, it did not work well with Macs, and I had to use it with key-swapping software. In addition, there was no way to access the function keys, which sometimes caused me a great deal of trouble.

Therefore, for 20 years, I had been thinking, “Someday, I would like to remake this keyboard into a modern keyboard….”

Reiwa NeXT Keyboard V1

In the fall of 2023, Yuyu showed me a keyboard that he had made by himself, which ignited my heart, and I started to aim for a complete transition to a self-made keyboard.

Basically, what we need to do is the same as before, which is to make a matrix decoder that matches the physical matrix. QMK provides an easy mechanism to do this.

Layout

The keyboard looks like a normal keyboard, except that the Function keys are missing, and the backquote is on the numeric keypad, but that’s OK.

Physical Switches

The NeXT keyboard uses ALPS cream axes. The light click feeling is very addictive.
(For more information about ALPS axis, please visit this site.)

Matrix Analysis

The above of the following figure shows the matrix of a PS/2 keyboard that I had posted on my web page 20 years ago.
The matrix was so extravagantly constructed that it would have required 25 matrix pins as it is.
I was able to reduce the number of columns by three, since the columns can simply be merged where they do not conflict with each other even if they take ORs (see the bottom of the figure). (bottom of the figure).

This still requires 22 GPIOs.
The Pi Pico has 26 GPIOs, so there are still 4 GPIOs left over for this application. We can increase the number of functions by allocating them to LED driving and I2C.

Hardware creation

Put Pi Pico on the board.

Cut the razor cable connected to the PS/2 controller, and connect it to Pi Pico’s GPIOs.
This is the first prototype, so we soldered the cable as it is, but it would be better to make the cable removable with a socket.


Install the USB terminal

3D print the base of the Pi Pico and make the USB port. The photo shows the prototype in red, but the final model will be in black.


The final shape looks like this. Compared to before modification, it looks much cleaner now that the extra board is gone.



Configuration of QMK

Configuration of the keyboard

  • Define MATRIX_HAS_GHOST for a matrix without diodes, like this keyboard.
  • The LED of CapsLock is controlled by GP0.


Keymap

The keymap is written in the same way as the previous matrix.

  • Use NeXT Power key as Fn key.
  • Page up, Page down for Volume up, Volume down (Fn key is the original function)
  • Brightness up, Brightness down as Home, End (press Fn for original function)
  • Fn + number” for “F1~F10
  • Left Command key alone for “Eisuji”, Right Command key alone for “Kana
  • The left Command key alone is “Eisuji”, the right Command key alone is “Kana”, and so on.
  • The Esc area is somewhat special, with a single press of Esc, Shift + Esc for “~”, and Shift + Alt + Esc for “`”.


The correspondence between the GPIO and the matrix to be used is written in info.json.


Creating graphical key layout with KLE

Create a layout in KLE for GUI when you change the key layout in VIA or Remap.


The key is to write the coordinates of the matrix in the Legend of the keytop.
The matrix of the PS/2 controller does not match the physical layout at all.

Setting up VIA

Create via.json file. This is used to change the keymap in GUI with tools such as Remap.
The contents of this file contains the key arrangement data created by KLE, the keyboard name, Vender ID, Product ID, and matrix of matrix.


The keyboard is ready to use!

After burning the firmware, the keyboard should be ready for use.

qmk flash -kb next_keyboard_v1 -km via


The source code is available on GitHub.

(Extra) Adding an OLED panel

The keyboard by itself is a little bit lonely, so I added a HUD-like display using a transparent OLED. This is a bit of a long story.



Actually, this story was just a prelude.
The main story will be in the next article.

See you!

Build Your Own Leopard Gecko Incubator

Build Your Own Leopard Gecko Incubator

This is the 8th day of Studio Aquatan 2023 Advent Calendar.

Hello, this is omzn, the lizard professor.

I have been keeping Leopard Gecko since last year, and have been managing it by borrowing a part of Akuatan system. (Click to enlarge) This system is now much larger than the aquarium.


there are four cages for lizards…



Today’s topic

This year, my leopard lizard started to lay eggs, so I made an incubator after much trial and error.
The first eggs hatched in my incubator, so I am recording them here.

Leopard Lizard Eggs

The leopard gecko generally lays two eggs per brood.
The eggs are laid in an egg-laying site created by digging up the bottom floor of the cage and then backfilled, so they can be dug up and transferred to the incubator. After the eggs are retrieved, the laying female still tries to hide them by covering the area where she laid them with soil, but it is a futile effort….


The eggs have soft eggshells that feel fluffy when touched. If the egg is accidentally rolled or dropped, it will die, so I mark with a magic marker where the egg was on the top when I dug it out. After that, always store the eggs with this mark on the top.
The incubator is placed in a Tupperware container lined with moss. Check manually from time to time to see if the moss is keeping the eggs moist.


Management of Leopard Lizard Eggs

It is recommended that the eggs of the Leopard Lizard Monster be maintained at a temperature of 26°C to 34°C and a humidity of 80% to 90%. Depending on the temperature, it is said that the eggs hatch in 40 to 70 days.
Since it is quite a long process, it is best to keep the eggs in a quiet place with stable temperature and humidity. The eggs hatched in 53 days after being kept at 28°C. Two more eggs hatched around 53 days later.


Humidity

If the humidity is not sufficient, the eggs will dry out and die. If the humidity is too high, the eggs will dry out and die, and if the humidity is too low, they will become moldy.
Therefore, I would like to keep the inside of the incubator at a constant humidity level. As for humidification, the incubator will be humidified on its own if we place something containing moisture (such as water moss) inside the incubator without doing anything in particular, so we will build the incubator with the policy of reducing the humidity that has risen too high.

Temperature

Temperature-dependent sex determination (TSD) determines sex according to the temperature during incubation[1].
(Note that if the incubation temperature is kept below 28°C, almost 100% of the eggs will be female.)
Therefore, temperature control is essential if the sex is to be fixed.

ヒョウモントカゲモドキの温度依存性決定([1]より引用)


Temperature-dependent determination of leopard geckos (quoted from [1])

Regardless of the sex, the temperature should not fall below 26°C, so some kind of heat-retention device is necessary. Here, I use a sheet heater to keep the temperature on the higher side. In my breeding environment, the room temperature is always around 26°C because the entire building is air-conditioned 24 hours a day. Therefore, in environments where the room temperature is too high and cooling is necessary, cooling must be taken into consideration.

Installation of the incubator

According to the above management policy, a mechanism to control the temperature and humidity inside the incubator is to be built.
The required components are as follows

  • M5 HUB Switch D (2-channel 100 VAC relay)
  • M5ATOM Lite (M5 ATOM S3, M5 ATOM S3 Lite, or any other type)
  • DC fan (5V drive)
  • ENV III Unit (SHT30 temperature/humidity sensor)
  • MOSFET (2SK4017)
  • 10kΩ resistor x 2
  • Sheet heater
  • DAISO shoe case

The main body of the incubator is a small shoe case from Daiso. A regular sized shoe case would be fine, but it may be too wide to hold the incubator. Also, the small size may be available only at larger Daiso stores. The small size can hold up to 10 eggs, and since it is 100 yen, there is no hesitation in processing the material, which is very good.



For humidity control, a fan is mounted.



Send PWM to the MOSFET through pin 25 of M5ATOM Lite to turn the fan in steps of 0 to 255. (Actually, the fan will not turn unless the PWM is set at about 65 because electromotive force is required.)
The fan is installed in a hole in the incubator lid, and the fan is turned in a direction that releases the internal moisture to the outside.
The humidity is measured by the ENV III Unit’s SHT30. The temperature and humidity can be easily obtained with this temperature/humidity sensor.
The fan is driven by PID control using humidity as an input. Since humidity is sensitive to fan operation, the humidity acquisition interval is as short as 2 seconds. In reality, it would be fine to simply turn the fan ON and OFF at a threshold value, but the following code is used for study purposes.

int Fan::manageByHumid(float h) {
  const float dt = 2;
  const float kp = 10, ki = 1, kd = 10;

  static float diff_p = 0, diff_c = 0, integral = 0;
  float p, i, d;
  int prev_power = fan();

  diff_p = diff_c;          // 湿度の差 (%)
  diff_c = h - _target_humid;  // 湿度の差 (%)
  integral += (diff_c + diff_p) / 2.0 * dt;
  integral = integral > 50 ? 50 : (integral < -50 ? -50 : integral);

  p = kp * diff_c * (diff_c < 0 ? 5 : 1); // 1 % で pwm 10 :負の時は x 5
  i = ki * integral;                //
  d = kd * (diff_c - diff_p) / dt;  // 1% で pwm 10
  float power = p + i + d;
  int ipower = constrain((int)power, 0, 255);
  DPRINTF("humid: %.1f, target: %.1f, power: %.1f (%3d)\n", h, _target_humid, power, ipower);
  fan(ipower);
  return (ipower && !prev_power || !ipower && prev_power);
}

The temperature is controlled by driving the seat heater with an AC relay.
Using M5 HUB Switch D allows ATOM Lite to run on a 100 V power supply, eliminating the need for extra wiring.
The second GROVE connector on the body of the M5 HUB Switch D has pin 25, so the fan circuit described above can be made at the end of this GROVE connector. Since the temperature change is not as short as the humidity change, the upper and lower thresholds are set to control the ON and OFF of the fan.

The final appearance will look like this.


The software will use a general-purpose environmental sensor system that is being developed by myself. This system is very useful because only the modules to be used can be enabled by the software. I am also building a server that records temperature, humidity, etc. using Raspberry Pi.

Incubator Monitor

An incubator monitor is also created to record the current temperature and humidity, the history of the incubation, and the number of days the eggs have been incubated.



The first eggs were kept in the living room next to the lizard cage, and the second and later eggs were moved to a storage room, where the humidity was more stable due to the lack of human activity.


Young leopard geckos

The same system can be used for rearing juvenile lizard cages, since the juvenile lizard needs a higher temperature and humidity environment than the parent. The cages are also made from Daiso shoe cases.
The humidity of the cage is set to keep the humidity at about 70% to 80%, and the current status is displayed on the LCD of M5 ATOM S3.


Crickets

The same system can also be used to maintain crickets. This year, I have been able to keep three generations of Dipterocarpus crickets by using this system. (ongoing).
The crickets are kept at about 60% humidity, but they are still doing well.
I hope the cricket farm will continue this year…



References

[1] J. M. Hall, Temperature dependent sex_determination in reptiles, Herpetoculture Magazine, isseue 17, March 2021, https://www.researchgate.net/publication/349718375_Temperature-dependent_sex_determination_in_reptiles