Monday, 16 October 2023

Fixing an Mbot

 A friend corrupted the firmware so now it doesn't do anything. 

https://www.makeblock.com/pages/mbot-robot-kit?utm_source=mblock&utm_medium=homepage

I found the Mblock IDE https://ide.mblock.cc which runs in my browser, and connected the Mbot via USB. 

Then I clicked on the MBOT and  up came a small window that said I needed to have Mlink 2 running, then gave me a link to get it, so I have downloaded it. 

It's installed but the IDE says I can't connect until it is turned on. 

from here, way down towards the bottom:

https://education.makeblock.com/help/obtain-and-install-mblock-5/

there is this command:

(2) Enter the following command to start the program:

sudo mblock-mlink start

Note: Do not close Terminal After opening the program. Otherwise, the device communication is disconnected.

Enter the following command to stop the program:

sudo mblock-mlink stop

OK, this connects. Now how to restore initial program.

https://www.vernier.com/til/4153

at the bottom of this page there is a link to a troubleshooting page.
I think the batteries may be low.  Batteries were very low. Try reflashing again.

New batteries and updated with Factory firmware and not on-line firmware, and it is sorted.

end of blog.  18/10/2023





Saturday, 22 July 2023

22/7/2023 Repairing an LG Flatron L225WS Monitor

The problem with this monitor is that it is good for a period and then blanks out. Switching it off and on again cures the problem for another period. It has been a while since I replaced it, but the period I think is about 10 minutes.    Is is a VGA monitor.

from here you can WhatsApp chat with their experts.

https://www.lg.com/uk/support/product-support/cs-L225WS-SF.AEK/#troubleshoot-tab

and have a look at these:

https://www.manualslib.com/manual/828260/Lg-Flatron-L222ws.html?page=8#manual  Looks good.



Sunday, 26 March 2023

Raspberry Pi as 3D printer control unit

26 March 2023 

1. I have given up for now trying to upgrade my 3D printer control board. 

Options are:

2. Buy a new printer [ >£200]

3. Buy a new control board [ ~£40]

4.  DIY with a Raspberry Pi - which will cost an unknown amount. 

It has been explored a bit here:

https://forums.raspberrypi.com/viewtopic.php?t=300484

and here:

https://hackaday.io/project/179342-sigmoid-s7p-3d-printer-control-board


How to do it and what do I need.

I  think a fairly up to date R-Pi, possibly a 3B+ 

5 Stepper motors: 1 - X-axis, 1 - Y-axis, 2 - Z-Axis, and a filament feeder

- driver hardware for these

Heating power to the filament coil and feedback thermistor.

Heating power to the Bed and feedback thermistor.

Driver hardware and A/D inputs for these.

Display and input buttons, knobs or whatever. How much of this could be done from a tablet? Or Octoprint? 

Knowledge of and ability to do whatever G-codes desire.

Some of this latter stuff could be obtained from the Marlin software.

Thought - Could the Marlin software be hacked for this? 



Friday, 24 February 2023

Family History by cars

 Getting our family history straight through the cars that we had, the trips we took, and the jobs we worked at.





1952 August we came to Canada and bought a 1947 Nash sedan.

After we moved to the lake, Dad bought the pregnant jellybean – a purple Nash station wagon.



The Nash was scrapped and pulled up to the dump across the road. The back axle 

I lowered down the back of the house while the parents were away and took all the skin off my palms.



That didn’t last too long and was replaced by a brand new pale blue mini. This was the first car that 

I drove.  In July 1963 we went down to Oregon in it. All six of us.



Ten he bought a green Austin A40 Somerset (for Mum) that had liquid filled front shock absorbers that

leaked. It also had a copper wing. When I went to Vernon Grade 13 college at the army camp

 (Sept '64-June '65) I drove both the mini and the Austin. I wonder if it was bought about then- tha

would be late 1964? It ended it’s life on the Lumby road when I was on the way to work at the 

lumber yard – my first job on return from University I think. Summer 1966. 

I think I must have worked at the lumber yard in Lumby and then in Cherryville in the summer 

before I went to university, and then at Donald all summer 1967 – I remember driving the Mini there.




Is it at this time that Dad bought a blue Pontiac from a woman who had kept it in her garage for 

years? I believe that it developed problems once on the Hope-Princeton highway, but don’t know 

it’s end.


Postcard from Viv dated  1967




Notes on that: I had thought that it was a 55 Pontiac but this postcard says '52.   

I didn't have a camera then so I'm not sure if any postcards survive.  

It was purchased by Garth Liseth, Vivian, and Gord Harris who each contributed $30.

The last known sighting of the car was in Gord Harris' parents driveway.

Gord must have disposed of it somehow. 



Vivian rolled the mini on the way down from Silver Star, but with three/four? Lads in it the

y just righted it and carried on. He also knocked out the sump on a rock out towards Cosins Bay 

and Dad got the guys at Galbraith’s to weld a patch on the sump where it was smashed. 

It was an experiment in Aluminum welding for them.



I bent the mini badly on the Port Mann Bridge driving into Vancouver in September 1968. 

I was carrying Beverly Ann Howe who had worked with me at the Army Camp Junior 

ranks shop. Richard says that he was with me. I drove the mini back to Vernon and Dad 

sold it. I am quite sure that Dad followed me home in the blue Pontiac. 

This is correct. I lived at Union Street in Burnaby and was seeing Bev until I met Marian that year.



The next summer 1969 I worked first at the Sergeants Mess and then at the Jr. Ranks bar at the Army

camp. I can’t remember which car I drove then. It was always evening work.



Then he bought a brown Austin 1100. This lasted until Richard and the road to Whistler parted company

in 1974.



Dad had a Blue Pickup that he parked on the road for awhile. The key was broken off in the ignition and

 the doors didn’t lock but that didn’t stop some yobbo from breaking the window and trying to get into it 

just as the police came along!



1969-1976 my main transport was bicycle.



When I graduated from university 1976 Mom lent me the money to buy a brand new Mini, which I sold 

when I left Canada in 1978. I won’t comment about Richard bending it.





Monday, 30 January 2023

Christmas Weather Station - 2

 30 January 2023  I have decided to give up on  getting OpenWeatherMap connected and displaying. 

I am going to get rid of that stuff, and maybe the Thingspeak stuff, and have the devices show the measurements on the displays directly. 

I will also try and set up the ESP8266 as an Access point so that I can browse to it and see my readings. 

On second thought I do not need to do that. All I have to do is set up a web page on it to show the data, so that it can be seen on my own network. 

Here is the link for doing the Access Point thing: 

https://randomnerdtutorials.com/esp8266-nodemcu-access-point-ap-web-server/

Hopefully it will also help to get the web server set up.  It leads to this

https://randomnerdtutorials.com/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide/

OK, I have taken out all the stuff relating to Thingspeak and OpenWeatherstation, and it compiles, But when it runs it connects to wifi, then displays nothing and reboots. 

Problem 1: get it to display current date and time. 

On-line monitor shows a bunch of error statements that occur between line 59 and 166. 

I have discovered that the error occurs in this section of code:

/code

int remainingTimeBudget = ui.update();

if (remainingTimeBudget > 0) {
   Serial.println("remaining time budget wait");
   // You can do some work here
   // Don't do stuff if you are below your
   // time budget.
   delay(remainingTimeBudget);
}

/endcode

I don't understand this ui.update, so have found I hope an explanation here to be read later:

https://forum.arduino.cc/t/using-millis-for-timing-a-beginners-guide/483573 - not much help. 

7/2/2023   OK, I have decided that the code for this is too complicated and not that well explained, so am looking elsewhere.

I have found: 

https://www.hackster.io/technuttiez/pocket-weather-station-using-arduino-2e5173

which leads to:

https://www.youtube.com/watch?v=ZhOhBuKC80M&t=460s   which points me to the next instructable for the code for this.

https://www.instructables.com/Pocket-Weather-Station-Your-Self-Care-Weather-Assi/

I had to install one more library - the Adafruit DHT one. and now it compiles. I'll check the pins for the DHT sensor before I try and load it. 

10/2/23 discovered an interesting site or two. 

https://github.com/lexus2k/ssd1306/wiki/Hardware-setup#esp8266-nodemcu 

This one shows the usual pinouts for the NodeMCU and the screen.

It came from here:

https://github.com/lexus2k/ssd1306

12/2/23 I have reverted to the modification of the weatherstation demo because it at least displays data on the screen. It also does set up the wifi and read the sensors.  

Have discovered how to convert an integer to a string so that I can print it to the display

String myString = String(n); 
That works. 
Now displaying Temperature and humidity at the following positions on the screen:
display.drawString(40, 10, "Temperature");  Top third
display.drawString(90, 10, myString);
display.drawString(40, 30, "Humidity");     just under half way down
display.drawString(90, 30, myString2);
I repeated this for the Light and Atmospheric pressure and it worked well. 
the figures in the lines above are (column, row, whatever)
    display.clear();
    display.drawString(40, 5, "Temp");     /line 5
    String myString = String(temp);
    display.drawString(40, 15, myString);  / line 15
    display.drawString(80, 5, "Hum'y");
    String myString2 = String(humi);
    display.drawString(80, 15, myString2);
    display.drawString(40, 30, "Light");    /line 30
    String myString3 = String(tempLight);
    display.drawString(40, 40, myString3);  /line 40
    display.drawString(80, 30, "Atm.Pr");
    String myString4 = String(tempAtom);
    display.drawString(80, 40, myString4);
    display.display();
This weatherstation program does not use the simple setup explained in this
https://randomnerdtutorials.com/guide-for-oled-display-with-arduino/
Tried to set it up using this program, but it uses different libraries and I can't set it up to use the I2C ports that my system currently uses. Guess I'll have to stay with what I have and just tidy it up.

Used the sample program for ESP8266 demo of I2C screen, and it is blue in the top 2/3 and yellow in the bottom 1/3.   When I look at the Amazon reference for the kit in the previous blog, it looks like the display if Blue/Yellow. So I have to live with it. 

I shall knock 2 off each of the row values and see if I get it all on the blue section.
That did it, so I know to write anything else that I want in the yellow section starting at row 40, or maybe 45 allowing for the height of the characters. [ used 46].

change these two lines and similar to:
 String myString4 = String(tempAtom);
 display.drawString(80, 40, myString4);
becomes
 display.drawString(80, 40, String(tempAtom));
Tidier. 
I need something that helps me display the time. 

https://www.circuitbasics.com/using-an-arduino-ethernet-shield-for-timekeeping/
https://randomnerdtutorials.com/esp32-ntp-client-date-time-arduino-ide/
-- looks more useful.
https://RandomNerdTutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/

24/2/2023 This one gave me the essentials, and I put it into my code and deleted a lot of
old time stuff that was interfering with it's compilation, and I got it working.
Changed display from centred to left oriented and some positioning values, and I am happy.



12/5/2023    Link to  a weatherstation using a Raspberry Pi

  https://www.donskytech.com/raspberry-pi-dht22-weather-station-project/







Thursday, 29 December 2022

Christmas weather station?

 Well, a parcel from Ben arrived today, and apparently it is the components for a weather station. 

[11:30, 29/12/2022] Ben Grant-Jones: Yes, looks about right. Does it have an Arduino, a screen and various sensors?

[11:36, 29/12/2022] Ben Grant-Jones: I think it's called an Ideaspark weather station kit.

https://www.hackster.io/alien-energy-3/what-do-i-build-next-a-simple-weather-station-cdc4ed

The wiring schematic is here

[11:37, 29/12/2022] Peter Merchant: Looks like 4 sensors, a computer board of some type, and other bits.

The computer in it is a LoLin NodeMcu v3.  Onwards and upwards!

Let's look at that Hackster  site and see how I'll put it together and what power supply is required. I think that that power converter that Ben sent in a previous parcel will be required here for 3.3V.

30/12/22 Bits included are:

A very small screen. I can't find a part number on it.   4 pins for power and serial comms. 

GY-30 Light intensity sensor. Also  5 pins for power and serial comms + ADO?

GY-68 180BMP Atmospheric pressure sensor.  4 pins for power and serial comms. 

11DHT (Possibly) Temperature humidity sensor. 

I think it is this: 

https://www.amazon.co.uk/Temperature-Humidity-Atmosphetic-BH1750FVI-YellowBlue/dp/B07GPBBY7F/ref=sr_1_13?crid=VBUYHQW3XS8M&keywords=ideaspark&qid=1672402295&sprefix=ideaspark%2Caps%2C81&sr=8-13

Have downloaded demo software from Blog site.

A BAD NIGHT:  Arduino IDE seems to have disappeared from my computer. I installed  Arduino IDE version 2.01, and it does not have my board, and the Boards manager is not present.   Time to give up for tonight.

Removed Arduino IDE 2.0? and installed 1.8.19

Installed the following libraries to get the hardware and bits to get it to compile

ttps://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json, https://arduino.esp8266.com/stable/package_esp8266com_index.json, 

https://github.com/vlast3k/Arduino-libraries/blob/master/SSD1306/SSD1306Wire.h

It gets over this now, and has an error with:   ESP8266_Weather_Station/src/ESPHTTPClient.h:4:10: fatal error: HTTPClient.h: No such file or directory

Other people who have done it:

https://randomnerdtutorials.com/cloud-weather-station-esp32-esp8266/

https://github.com/ThingPulse/esp8266-weather-station   [ this might be the one used here]

https://thingspeak.com

23/1/2023 - Working through the compilation: 

fatal error: SSD1306Wire.h: No such file or directory

this is installed: SSD1306 oled driver library for the Wemos Mini OLED shield (64x48)

but is it the right one? 

Installed:  / esp8266-oled-ssd1306

That got a lot further, but now:

WeatherStationDemo:70:21: error: 'D3' was not declared in this scope

   70 | const int SDA_PIN = D3;

and same with D4. 

Changed from Generic 8266 Module to Lolin Wemos D1,R2 and Mini

That Verified!  Let's program it. 

25/1/2023

Now all wired up, and connected to Wifi, displaying forecasts. 

There is an error in the wiring diagram in the Hackster weather station that I am building.  The Ground and VCC of the display go to the wrong pins. 

Next step is to look at software and see how to get to read the sensors.

NOTE: when I load software into the Arduino IDE, change board to ESP8266 -> Lolin (Wemos ) D1, R2, and Mini

#define TZ              0       // (utc+) TZ in hours
*** Bad one - later TZ is multiplied!
TZ=0 gave UTC+1, 
TZ= 1 gave UTC+2

But have I not set up something correctly. 

String OPEN_WEATHER_MAP_LOCATION = "London,GB";

STEP 5  Register OpenWeathermap, thingspeak new account

https://github.com/ThingPulse/esp8266-weather-station/blob/master/examples/WeatherStationDemo/WeatherStationDemo.ino
gives a link to Thingspeak to get the API code for the weatherstation. 
I have put this in the .ino file. 
Now I believe i need to select the weathermap location. 

const char *host = "api.thingspeak.com";                  //IP address of the thingspeak server

const char *api_key ="c4b7d4b2331c0baac3e329358384e378";                  //Your own thingspeak api_key

This one is wrong I think

and this one is correct:

String OPEN_WEATHER_MAP_APP_ID = "c4b7d4b2331c0baac3e329358384e378";

String OPEN_WEATHER_MAP_LOCATION = "2633863";

Time is now wrong by +2 hours and all data is set to 0.

and the next few days info is all thurs,thurs,thurs, so something has gone wrong with the timing.

from here: https://nothans.com/thingspeak-documentation/api

In order to update a channel, you need to know your Write API Key. If your Write API Key gets compromised you can generate a new key.
Follow these steps to get your Write API Key:

  • Select Channels
  • Select the Channel to update
  • Select Manage API Keys      
There is also a read API Key. I don't know which I need here. 

On the thingspeak channel display I can see that all sensors are displaying some changes. Success!

--------------- --------------- ------------ -

26/1/23  Got time right. Had to set TZ to -1.

Have to use 'write' API key to write things to thingSpeak. 


This is what serial monitor shows:

temp:18    humi:62

light: 165

Pressure = 103155 Pascal

temp:18    humi:62

light: 165

Pressure = 103153 Pascal

temp:18    humi:62

light: 165

Pressure = 103154 Pascal

temp:18    humi:62

light: 165

Pressure = 103145 Pascal

SO why doesn't it display!

27/1/23 Changed Channel view from private to public, but it still doesn't display, so it doesn't read the stuff. 

29/1/23  Current state.
There are three things, 
1] It gets and displays the time     --Yes
2] It reads the sensors and writes them to Thingspeak  --Yes
3] It reads the weather forecast from OpenWeathermap and displays it on the two screens.   --No. 

Some other sites that may give some help:

https://randomnerdtutorials.com/esp32-http-get-open-weather-map-thingspeak-arduino/

https://forum.arduino.cc/t/arduino-uno-esp8266-01-and-openweathermap-org-for-weather-monitoring/458438
 -- waste of time.

https://www.instructables.com/Esp8266-Weather-Data-Parser-Openweathermap/
 - This uses a totally different TFT screen and would be far too much work to convert. 

Tried it with the Thingspeak API read key for Openweathermap - didn't work.


30/1/2023  End of. Going to leave this project for a bit. 







Tuesday, 8 November 2022

New Project - Reprogramming/fixing a Smart WiFi Socket

Following on from discussions on Twitter, I think that I should do this. 

It uses Tasmota devices and MQTT  to show what is using power when. 

An excellent writeup  by @Brunty in his blog:  https://brunty.me/post/energy-monitoring-2022-edition/

To start I need some Tasmota devices. They ain't cheap.

Can I convert my TUYA Smart devices to Tasmota. @Andysc says I can. Will I still be able to control them to turn TV ON & off at specified times automatically? 

There is Tasmotrol, but it is written by a person (Yvonne Joh) who I don't know anything about. Does it feed stuff back to China like TUYA Smart? 

I will need a home Server running 24/7, and at the moment all I have is a few spare black tower PC's. 

Can I find a small unit that plugs into a mains socket and will support some storage?   Looked for 'PC in a plug' and found some references to things like Sheevaplug, but they all seem to have ceased. 

I'll have to get a Raspberry Pi to fit into my dead Humax box when they are available. 

Suggestion that I should look at Balena_io and MING. I might have to learn some more programming if I went that route. 

Keep thinking about it.  Have discovered that Enphase uses MQTT, but I think that this is in old versions of the software. Good if it still does.  How can I test it?

21 Nov. 22

Going to flash one of my TUYA smartplugs with Tasmotrol.

The device is a https://expo.tuya.com/product/627497  model J2-SU-E16

Following https://www.superhouse.tv/44-over-the-air-tasmota-conversion-with-tuya-convert/

Setting up Rasberry Pi (10) 

It has flashed, Not sure if it was successful. 

When plugged in, no light. But Wifi Network tasmota_02AC61-3169

MAC address 12:e9:be:e7:26:65


Have left a comment on the superhouse web page.

26 Nov 22. Have taken it apart and discovered that the chip in it is a common Popular one ESP-12S, and have unsoldered it from the unit. Have ordered a USB to TTL serial interface board so that I can program it. 

Best link that I have found is: 

https://templates.blakadder.com/ESP-12.html

This one has videos of programming them. 

https://www.hackster.io/brian-lough/3-simple-ways-of-programming-an-esp8266-12x-module-c514ee


29 March 2023 looking at this to make it simple:

https://www.youtube.com/watch?v=8yxEgYvoHY0

I have now found tasmotizer:

-- peterm@peterm-MBB-34204H:~$ find -name "*tasmotizer*"
-- ./.local/bin/__pycache__/tasmotizer.cpython-38.pyc
-- ./.local/bin/__pycache__/tasmotizer.cpython-310.pyc
-- ./.local/bin/tasmotizer.py
-- ./.local/lib/python3.10/site-packages/__pycache__/tasmotizer_esptool.cpython-310.pyc
-- ./.local/lib/python3.10/site-packages/__pycache__/tasmotizer.cpython-310.pyc
-- ./.local/lib/python3.10/site-packages/tasmotizer-1.2.1.dist-info
-- ./.local/lib/python3.10/site-packages/tasmotizer_esptool.py
-- ./.local/lib/python3.10/site-packages/tasmotizer.py
-- ./.local/lib/python3.8/site-packages/__pycache__/tasmotizer.cpython-38.pyc
-- ./.local/lib/python3.8/site-packages/__pycache__/tasmotizer_esptool.cpython-38.pyc
-- ./.local/lib/python3.8/site-packages/tasmotizer-1.2.1.dist-info
-- ./.local/lib/python3.8/site-packages/tasmotizer_esptool.py
-- ./.local/lib/python3.8/site-packages/tasmotizer.py

But it won't run because it is missing some bits

following instructions to install tasmota from web i/f But it cannot find USB serial port. 

https://tasmota.github.io/docs/Getting-Started/#needed-software

Web:  https://tasmota.github.io/install/

Have downloaded basic Tasmota from http://ota.tasmota.com/tasmota/release/

This nearly works with the TTL-USB dongle that Ben gave me. It didn't react with Mine. 

Here is another story about step-by-step programming a device with Tasmota.

https://blog.horner.tj/emporia-smart-plugs-tasmota/

This tells how to set Bootloader mode on GPIO15 (pin10)

https://docs.espressif.com/projects/esptool/en/latest/esp8266/advanced-topics/boot-mode-selection.html

7 April 2023.

So I need GPIO-15 Pulled low to enable flashing. This is the pin next to GND. 

SUCCESS!

Following a hint online:

sudo apt-get install python3-pyqt5.qtserialport

and now this works:

 python3 ./.local/lib/python3.8/site-packages/tasmotizer.py
and brings up tasmotizer. 

But I need to find the config file. 

On TAsmotizer, just click the little box for the section that you want to config, so I did and added the Wifi credentials, and then 'saved' this config, which sent it to the device.   Fing found it, but the tasmotizer tablet app didn't. I think I need to set up a tasmotizer web server for this, which probably means using a Raspberry Pi. 

Correction: Fing did not find it. and searching for a WIFI connection to it found nothing either. 

Wrote to Horner re my problems

Hi, as suggested in your blog on this, I am asking for the benefit of your experience. I have an unbranded Smart Switch with TUYA software. It is very similar to the Lombex unit: https://templates.blakadder.com/lombex_U11.html.   I have removed the ESP12 microprocessor and connected it to my Kubuntu computer, and have been able to flash it using 

https://tasmota.github.io/install/   It was necessary to connect both GPIO-15 and GPIO-0 to 
ground to get it to flash. and then have started Tasmotrol to configure it, which seems to work. 
I then tried to send the generic module configuration, and that transferred. The problem is that the 
device never appears in my wireless network  - testing with fing on my tablet. 

Not sure what other info I can give you to help. Attached is a picture of the connection.
 
The ESP-12S came out of the slot on the main board of the unit. 

Any thoughts appreciated,
------------------- ---------------- ------------
another similar plug:
https://templates.blakadder.com/silentnight_485418G.html 

with a comment that  New Tuya devices have replaced their Wi-Fi module with one incompatible 

with Tasmota!!!

10/4/23 Likely conclusion: None of the Tasmota buolds loaded  have had wireless working, so my 

supposition is that Tuya are using an ESP-12 in this device that uses the Realtek wifi drivers rather 

than their original ones. 

I am going to test this hypothesis using these three links:

1]  https://www.instructables.com/Getting-Started-with-the-ESP8266-ESP-12

2]  https://www.instructables.com/ESP-12E-ESP8266-With-Arduino-Uno-Getting-Connected/

3]  https://circuitjournal.com/programming-esp8266-over-wifi

This one 3] is about working with these variants ESP-12E / ESP-12F / NodeMCU so I'll leave it for now. 

2] is about an 8266 E and builds on 1] so I'll start there. 

It has a warning about not using the 3V3 from the USB-TTL adapter as it doesn't supply enough power. 

I cannot get the Arduino IDE serial monitor to  show anything. 

Trying to get an Arduino program working for the ESP8266, and I just get this error:

"module 'time' has no attribute 'time_ns'" in /tools/mkbuildoptglobals.py  and can't find a cure. Something to 

do with the version of Python perhaps. 


16/4/23  Interesting teardown of a couple of smart plugs:

https://www.hackster.io/news/teardown-of-a-smart-plug-or-two-6462bd2f275b

The TCP-Smart plug that I have  contains this:

https://developer.tuya.com/en/docs/iot/wb2s-module-datasheet?id=K9ghecl7kc479

and looks like this. 











2023-05-19

Discovered a new article about programming an ESP-12 with Tasmota

https://www.elektroda.com/rtvforum/topic3816654.html

It implies that the  WB2S in the TCP switch has to be replaced with an ESP-12 device.