Reading DHT22 and Light sensor data using NodeMCU dev board

Experimented with reading DHT22 amd Light sensor modules using NodeMCU ESP12E development board. Main problem I had that timer did not work on old firmware, had to update it ( read previous post ). Other that that all went fine and could read data.
One strange thing is that I am getting temperature a little bit higher than actual. Not sure why is that, maybe because board is powered by 3.3v and not 5v. Will have to find out that later.


if not tmr.alarm(0, 5000, tmr.ALARM_AUTO , function() 

print("Starting to read data:")

light = or ""

pin = 4
status, temp, humi, temp_dec, humi_dec = dht.readxx(pin)

if status == dht.OK then

-- Float firmware using this example
print("DHT Temperature:"..temp..";".."Humidity:"..humi)

elseif status == dht.ERROR_CHECKSUM then
print( "DHT Checksum error." )
elseif status == dht.ERROR_TIMEOUT then
print( "DHT timed out." )

end) then print("whoopsie") end

tmr.alarm not working on ESP12E 0.9.5 firmware

Tested that this sample was not working on dev board:

if not tmr.alarm(0, 5000, tmr.ALARM_SINGLE, function() print("hey there") end) then print("whoopsie") end

Checked firmware version (connected to ESPlorer and pressed reset):
ESP12E default NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4

Decided to update firmware. Found here that only 9.6 is available precompiled, later ones have to be costum built. Downloaded 9.6 files and uploaded them using ESP8266Flasher.exe

Checked firmware version then:
NodeMCU 0.9.6 build 20150704  powered by Lua 5.1.4

And tested this code sample:

if not tmr.alarm(0, 5000, tmr.ALARM_SINGLE, function() print("hey there") end) then print("whoopsie") end

It worked.

How to use Arduino IDE to program NodeMCU

1. Install the Arduino IDE from download section of website 
2. Run Arduino IDE’s arduino.exe
3. Arduino IDE >> File >> Preferences (Shourtcut is CTRL + COMMA)>> Settings tab >> on Additional Board Manager URL side type this >> and click ok.

This json object will bring necessary drivers for NodeMCU from the website to our Arduino IDE.
4. Arduino IDE >> Tools >> Board >> Boards Manager… >> Type = Contributed >> click on install (Or, search ESP8266 from the search bar)
5. Arduino IDE >> Tools >> Board >> NodeMCU 1.0 (ESP-12E MODULE)

Repairing ZX Spectrum Kempston joystick

As recently I started tinkering with ZX Spectrum hardware, tested one old joystick I had. Up and right positions did not work during the games. Tested port reading with one simple program:

10 LET x=IN 31
30 GOTO 10

There was no reading in up and right position.
I took apart joystick case and tested connection between PCB and plug – there was no connection for up and right wires.

So, just took now DB9 female connector and soldered it instead of an old one that I have just cut away.


Fixing ZX Spectrum+ 48K (s/n S01-135100) video problems

So, this ZX spectrum was alive, but during testing with some games (for example game “Breakthrough”), I noticed strange video glitch in upper screen part:

My guess was it is not video RAM related, but probably RF module fault. First decided to change all electrolytic caps on the board and see if it helps – it did not. Picture was the same.

Then decided to check RF module – remove it and re solder all joints.

After putting it back I did a check with the same game. It helped a bit, but still I was not happy with the result. White line disappeared, but it seemed like upper part was washed away a bit:

And then it came to my mind a thought about why the hell I am using this RF module at all. I could just do a composite mod and that would definitely would solve all RF related video problems.

Composite mod as it is called, is just disconnecting power and signal wires that go from RF module – means disconnecting RF module. Then, in the RF module itself, disconnecting resistor from video output connector. And finally, connecting video output from board to video output connector in RF module using 100uF 10v electrolytic capacitor ( negative to the board, positive to video output ).

That`s it, did those changes, connected to TV`s composite video input and got clear picture without any RF glitches.

( Making this change i did not cut any wires etc. Just desoldered and moved away. Idea is that I could easily return RF module functionality i.e. undo this mod. )

Another ZX Spectrum 48K

Maybe I got carried away.. but here is another non working rubber keyboard ZX Spectrum I got (s/n D01-257600).

Its interesting regarding those serial numbers, some are 01 some D01. I really would like to know what do they mean, if they mean anything ? Found one site that has list of some serial numbers and has a form to submit more. Probably later I will submit them serial number of my ZX Spectrum machines. But now, back to this one..

On the outside it has some bruises and scratches, also it has lost all of its rubber pads, but inside looks good.

Actually it looked so good that I powered it immediately and saw nice working home screen. But after pressing some keys found than none of them work. No wonder why because when opened the box immediately found reason.

Keyboard membrane connector was cracked near the connector and was totally broken near the membrane, So, it seems that now I am looking after replacement membrane,

To be continued.

Repairing ZX Spectrum+ 48K

Another was ZX Spectrum+ 48K (s/n S01-135100). After turning it on could not see clear image (sorry did not take image of that picture). When I disassembled this device I found that it already had some changes, lower RAM chips were not original, it had some jumper wires soldered on PCB, transistor TR4 seemed like already replaced (at least someone did some soldering with it). 

Expecting the worst I started to check voltages (using this guide) and noticed that 12V is missing on lower RAM chips. When checked transistors TR5 and TR4 found that TR4 is most probably faulty. 

TR4 is ZTX650 and I started searching replacements for it. Somewhere in a forums I fount that:

  • TR4 ZTX650 can be replaced with 2SD1207.
  • TR5 ZTX 213 can be replaced with 2SA733 ( or BC212, BC257, BC307, BC557).

I could easily find 2SD1207 and replace it. Just one important thing – pins of ZTX650 and 2SD1207 are different:

But good thing is that it was already overlooked by ZX Spectrum PCB designers and it had holes for alternative pinout transistor near the original one ( see photo ).

Voltages immediately changed to correct ones. After powering it up it started nicely. Whoohoo, it was an easy fix.

*One interesting thing is that on the back of ZX Spectrum case there was a sticker with text: 31.7.86 RR 47293 C.DAVIES. Not sure what does it mean, maybe information about performed repair or previous owner.

Oh.. and noticed just now, there is a sticker about repair on RF module also:

Repairing and upgrading ZX Spectrum 16K

Going back into retro computing. Recently got little bit nostalgic and purchased two used non working ZX Spectrum machines. One was 16K, SN 001-201230.

Tested some voltages using this guide and it seemed like everything is more ore less normal. Plugged it to TV antenna, tuned to channel 35, turned it on and as expected it didn’t work. As usual biggest suspects were 4116 lower RAM chips:

I had two options, first was to cut those IC`s out and desolder leads that were left using regular soldering iron. But doing that I would destroy those chips and I had a feeling that only some of them are not working and I could use others later. So, I bought cheap desoldering pump with a heater and spent some time desoldering those eight 4116 RAM chips. Actually, before that I have never used such desoldering pump and now I can say it does magic and I cannot imagine how I did all my electronics tinkering before without it.

Then I just took eight 16 DIP sockets and soldered them in places where those IC`s were:

Next thing was to find something to replace 4116 chips. I could not found 4116 somewhere around and buying them online takes time and actually they are quite expensive and, talking the truth, not so reliable. Another option was to replace them with newer 4164 chips. But then one slightly modification will be needed on PCB or chips itself as 4164 do not need +12v voltage and only are powered with +5v. And, I did not find 4164 around also, but found some old Russian clones K565RU3, RU5 and RU6.

K565RU3 is exact clone of 4116 so it is also not reliable and also expensive.
K565RU5 is exact clone of 4164, has 65536 bits.
K565RU6 is similar to 4164 but just have same amount of memory as 4116 i.e. 16384 bits.

So, I got some K565RU5 and K565RU6 chips. Decided that RU6 will go instead 4116 lower ram and RU5 chips will go to upgrade this 16K ZX Spectrum to 48K.

Regarding modifications needed to replace 4116 with 4164 ( or K565RU6 in my case ).

As we see pins 1 and 6 on RU6 are not used.
Pin 8 on RU6 is +5v and on 4116 is 12V.
So, the idea is to get rid of the pin 1 and power pin 8 from pin 9 on K565RU6 .
One way to do this is to cut some traces on board and add couple jumpers but I wanted to preserve original PCB as much as possible so went another way: just cut pin 1 away and bent pin 8 up and connected it with pin 9 using short wire.

After preparing all eight RAM chips the moment of truth came. First I have checked all the voltages in a dip sockets without inserting any chips. Only after, when everything seemed alright I inserted all of them in to the sockets and powered up.

Yes, and to my disappointment, it didn’t work. Picture was a little but not much different as with previous ones. Rechecked the board, voltages and my soldering and all seemed right. So, as previously I was guessing that some 4116 where good, I started playing with putting some 4116`s with some K565RU6 with hope to find faulty ones. And to my surprise after some time I got this screen:

Then, when I knew which of those IC`s are ok it was easy to check every other chip and to find bad ones. At the end I found one 4116 and one K565RU6 were to blame.
Trying to be as much authentic as possible I decided to keep all 4116`s in the board and just use one new K565RU6:

Next step was to upgrade this baby from 16K to 48K. This ZX Spectrum Issue 2 board already had all slots needed for upgrade. To upgrade You have to:

  • Install the 4164 RAM (in my case it was K565RU5) Chips into the eight sockets marked IC15-IC22
  • Install the74LS32 chip into socket marked IC23
  • Install the 74LS00 chip into socket marked IC24
  • Install the 74LS157 chips into the sockets marked IC25 and IC26
  • And add one jumper wire:

Issue TWO boards – On the right of IC1 (the large ULA chip) there are 3 pads, the top is marked
“+5v”, the centre is unmarked and the bottom is marked “0v”. Either the top or bottom pad should be connected to the centre pad
It was easy peasy, no other modification were needed. The result:

Then tested the amount of ZX Spectrum RAM with this small basic program and the result was 65535:
PRINT PEEK 23732 + PEEK 23733 * 256
The value printed should be:
(a) for a 48k unit – 65535
(b) for a 16k unit – 32767

*also during tinkering with the pcb i have replaced some of the electrolytic capacitors, everyone recommends that, but actually i did it probably mostly because i wanted to just to use my new desoldering pump few more times… 😉

Next post is going to be about repairing ZX Spectrum+ 48K