I am making more SD card copies because I often made newbie mistakes which ordinary linux users will not make, and I don't have enough knowledge to understand what goes wrong. For example, I don't know what is alias, why use “./” in front of file names, what is environment etc. When I tried to update software, for example, last time from Lua 5.1 to 5.3, I found one update method did not work, then tried another one, and yet another one, ending a big mess and could not recover. So I needed to use a new SD card, and needed to install all the tools again, wasting hours, ...

So the lesson learnt is to make more copies of SD card at the end of a development stage, or so called a milestone, so in case I made a mistake and messed up the raspbian os, I can fall back to a previous version SD card, ...

Part B - Create Boot SD Card continued, ...

Note: I tried 32GB card but found only 16GB detected. I am not sure if I can expand it later expand it. So for now it is better to use 8GB or 16GB cards.

So the lesson learnt is to make more copies of SD card at the end of a development stage, or so called a milestone, so in case I made a mistake and messed up the raspbian os, I can fall back to a previous version SD card, ...
Note: I tried 32GB card but foundonly 16GB detected I am not sure if I can expand it later expand it. So for now it is better to use 8GB or 16GB cards.

8GB SD card good for newbies

I am trying 8/16/32 GB cards. I found the most popular SanDisk 8GB (HD video, microSDHC) best for newbies. It is cheap, format and transfer data quick. So far I have no problems.

So the lesson learnt is to make more copies of SD card at the end of a development stage, or so called a milestone, so in case I made a mistake and messed up the raspbian os, I can fall back to a previous version SD card, ...
8GB SD card good for newbies

Made 7 SD boot cards, ready to boot Rpi and config Raspbian stretch

Now I have copied 7 SD cards and put them in my high class plastic SD card safe. The time has time to check out if these cards can boot Rpi.

Made 7 SD boot cards, ready to boot Rpi and config Raspbian stretch
Now I have copied 7 SD cards and put them in my high class plastic SD card safe. The time has time to check out if these cards can boot Rpi.

Newbie notes on setting up Rpi Raspbian Version 2018Nov Desktop

Raspbian version 2018nov is more newbie friendly than before, no more confusions on UK/US English and keyboard settings, all GUI, no scary terminal sudo commands,

I am not too sure if I still need to do some fine settings, using terminal commands. So I list the old 2015-2017 methods below, just in case I need to fall back to the old methods, fiddling the scary things like device trees, config files, etc, using the ugly editing program call 'nano', ...

Raspbian Desktop > Assessory > SD Card Copier to make copies

Now I am using the SD card copier to duplicate SD cards, between 8/16/32GB cards. Each 8GB to 8GB copy takes about 15 minutes.

I connected three more I2C MCP23017 (addresses 0x21 + 0x32, 0x22). Together with the RTC + EEPROM addresses 0x57, 0x68, I repeatedly swapped I2C channels and devices and finally found the trouble maker, the MCP23017 with address 0x22.

If the 0x22 mcp23017 is not connected, the other 3 devices behave very well, using i2cdetect -y 1 can 99% of times detect the correct addresses.

However, when the bad guy joins the party, then the annoying intermittent addresses not detected happen almost 90% of the times.

So my conclusion is the following:

Any bad I2C device could corrupt all the I2C channels.

If I have discovered this situation two months ago, I would not have to wasted perhaps two hobbyist weeks troubleshooting intermittent weird MCP23017 events!

Upton has been working to transform STEM education and inspire the next generation of technology talent.

“A device that was originally conceived as a toy for kids is now finding its way into a wide range of industrial applications.

Last year, more than half of our 6 million unit sales were into industrial or commercial applications,” he says.

“We're not going to stop until everyone in the world has access to a low-cost, high-performance PC, and every child has a chance to understand how their PC works, and to use that knowledge to secure a better life for themselves."

Eradicating the tech skills shortage

In 2018, the technology skills gap is still a major challenge. Research claims there’ll be 800,000 unfilled IT roles in the UK alone by 2020, and the British Computer Society has suggested that the number of students taking computing courses will halve over the coming years.

“We're in a much better place than we were a decade ago. We’ve gone from having an ICT curriculum which focused on office skills to an extremely rigorous computing curriculum.

At the same time, Upton believes that the general public is becoming more aware of the importance of STEM learning.

Tackling diversity in tech

To Upton, the real challenge is making the tech industry more inclusive - particularly when it comes to gender diversity. According to industry body Tech Nation, women in tech are outnumbered by men 4:1.

“The challenges we think about now are around diversity and inclusivity, and about how we make computing relevant and provide an opportunity for steady progression that keeps young people engaged,” he explains.

“We've felt for a while that one of our pieces of unfinished business is to ensure that the resurgence in interest in computing among young people is more balanced than the surge in the 1980s that I was part of: heavily male and middle-class.”

“We have some promising leading indicators: of attendees at Code Club (a program for 9-13 year olds), 41% are female, and a school in a disadvantaged area (as measured by the proportion of students on free school meals) is somewhat more likely to have a Code Club than one is a more affluent area.”

Although this is beginning to improve, Upton admits that more needs to be done. “There are specific techniques which have been established in the literature to improve girls' level of engagement.

“One example would be pair programming, an established software engineering technique whereby pairs of people sit together at a single machine and work to tackle a problem....

Any bad I2C device could corrupt all the I2C channels.[/i][/color]
Tidying up tri level converter and rtc wiring notes

MCP23017 Evaluation Board Newbie Version 0.1

In the earlier projects, I found MCP23017 not reliable, often causing intermittent (remote IO errors) I2C errors. I have been using both through hole and SMD components from a couple of reputable TaoBao shops. So I quickly concluded that MCP23017 itself is not that reliable, comparing to other I2C devices I tested, such as RTC, which I found more stable. That is one reason I always use a manual/software reset button in case MCP20317 hangs.

I usually placed two MCP23017s on a single board, with all connecting wires as duPoint female to female cables, 15cm or 30cm long, but not longer, unless very necessary.
This way I can easily swap any MCP23017 on board, or other boards. And for each MCP23017, every connection is jumper selectable, so it is easy to swap any connecting wire or port pins etc.

I also placed a huge, 470uF electrolyte capacitor, and a 10uF tantalum cap very near to the on the 5V power connector, and 10uF and 0.1uF tantalum very near to the MCP23017 power pins.

I also found RTC DS3231 much more stable than MCP23017. So in case of unknown MCP23017 errors, I usually check if RTC DS3231 is OK. In other words, DS3231 is a canary in the coal mine, ...

MCP23017 Evaluation Board Newbie Version 0.1
I also found RTC DS3231 much more stable than MCP23017.

Effect of very long I2C connecting wires

I also compared the effect of using long, 90 cm wires, with short 30 cm wires. I surprisingly found that there is not any noticable effects, when using i2cdetect -y 1 to detect 4 iox I2C address.

My conclusion is that length of I2C wires less than 1m should not have any bad effect on I2C operation. On the other hand bad I2C devices would have a fatal effect. I guess because bad I2C devices increase total capacitance more than long wires.

I also read that Rpi I2C data pin already has a very strong 1k8 pullup, so there no use making it stronger resulting larger current, with a risk of overloading Rpi. See discussion below.

Earlier I wrote a ESP8266 NodeMCU Lua 5.1 blink program but found it not able to blink faster than 1kHz, therefore useless to control HX711 which requires control pulses of period less than (50uS x 2) = 1S/100uS = 1,000,000uS / 100uS = 10,000 = 10kHz.

Now I am thinking of forgetting about ESP8266 NodeMCU and try my luck again on Rpi stretch Lua. I need to first find if there is any usable Lua GPIO packages.

First thing is to convert the Rpi 3V3 GPIO signals to 5V0.

Update 2018dec07hkt1545

I googled Lua related forums but could not find any GPIO package for Rpi3. I also
used the command $ apt-cache search '^lua-.*' and neither find anything useful. So I guess I have to give up ESP8266 Lua GPIO. My original plan was to use ESP8266 GPIO to directly control HX711. Now I need to use perhaps python to use Rpi to directly control HX711. But if I use Rpi python, I can as well use Rpi to control MCP23017 which in turn controls HX711....

Raspbian has a software I2C driver that can be enabled by adding the following line to /boot/config.txt:
dtoverlay=i2c-gpio,bus=3

This will create an I2C bus called /dev/i2c-3. SDA will be on GPIO23 and SCL will be on GPIO24 which are pins 16 and 18 on the GPIO header respectively.

For further information about i2c-gpio and the parameters it supports see /boot/overlays/README on the Raspberry Pi.

Rpi /boot/overlays/README

Introduction

This directory contains Device Tree overlays. Device Tree makes it possible to support many hardware configurations with a single kernel and without the need to explicitly load or blacklist kernel modules.

On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt.

In /boot you will find a .dtb for each base platform. This describes the hardware that is part of the Raspberry Pi board. The loader (start.elf and its siblings) selects the .dtb file appropriate for the platform by name, and reads it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) are disabled, but they can be enabled using Device Tree parameters:

bus Set to a unique, non-zero value if wanting multiple i2c-gpio busses.
If set, will be used as the preferred bus number (/dev/i2c-<n>). If
not set, the default value is 0, but the bus number will be
dynamically assigned - probably 3.

Replacing I2C MCP2307 by SPI MCP23S17[/b]
I have been thinking of using Rpi software I2C, but found the speed limitation problem and instability problem might not likely to go away.
So I have decided to give up I2C MCP23017, and divert to SPI MCP23S17[/color]

Final testing of 8 MCP23017 modules

Before packing and putting on the shelf my 8 miserable MCP23017s, I am doing some final checking up and making a record, in case I am coming back.

I first checked 4 reliable modules, deliberately using 90cm long I2C cables and 75cm long 5V power cables, and found i2cdetect command working OK for a row of 50 times....

Replacing I2C MCP2307 by SPI MCP23S17
I have been thinking of using Rpi software I2C, but found the speed limitation problem and instability problem might not likely to go away.
So I have decided to give up I2C MCP23017, and divert to SPI MCP23S17

Quad SPI Mux Level Converter Board assembly notesTXS0104E 4-Bit Bidirectional Voltage-Level Translator for Open-Drain and Push-Pull Applicationshttp://www.ti.com/lit/ds/symlink/txs0104e.pdfMax Data Rates - 24 Mbps (Push Pull), 2 Mbps (Open Drain)
When the output-enable (OE) input is low, all outputs are placed in the high-impedance state.
The TXS0104E is designed so that the OE input circuit is supplied by VCCA.
OE = 3-state output-mode enable. Pull OE low to place all outputs in 3-state mode. Referenced to VCCA.
OE input max = 5.5V (Datasheet ss6.3 Recommended Operating Conditions)
To ensure the high-impedance state during power up or power down, OE should be tied to GND through a pulldown resistor;

I found out the hard way that in order to set up multiple MCP23S17 chips you need to set up all the chip modes in a strange way at startup. There is some bug in the errata and if you have multiple chips wired for different addresses A0,A1,A2 then recognizing these addresses does not work out of the box. You need to run "setChipModes()" to make them work....

SPI Detect Program Example 1...Now I have debugged a minimal, compete, verifiable example (MCVE) program to repeatedly send single byte on a SPI port, and used a scope to display the waveform.
The program is only about 50 lines long, as displayed below....

Now I have debugged a minimal, compete, verifiable example (MCVE) program to repeatedly send single byte on a SPI port, and used a scope to display the waveform.

Testing Rpi3B+ SPI at frequency 1MHz OK

Last couple of months I played with Rpi I2C MCP23017 and found Rpi's 100kHz limit is too slow for DHT22 and HX711. Therefore I gave up I2C and MCP23017.

This time I am anxious to check if SPI can do 100MHz properly. I used the same program and set frequency to 1MHz. The scope show that the SPI at 1MHz still looks OK, expect the square waves have round corners. I am not sure if it is because my old scope of 100MHz, 1GSa/s is not that HiFi, or the wave form is indeed not that like a square wave.

Anyway, next step is to check SPI loop back, to see if MISO pin can read MOSI's output, at 100kHz and also 1MHz.

To do
I noticed that 1 byte sent only takes 8 clock pulses, not 9 pulses (8N1). I need to check if I misunderstood something....

Testing Rpi3B+ SPI at frequency 1MHz OK
This time I am anxious to check if SPI can do 100MHzErrata - I meant 1MHz properly. I used the same program and set frequency to 1MHz. The scope show that the SPI at 1MHz still looks OK, expect the square waves have round corners. I am not sure if it is because my old scope of 100MHz, 1GSa/s is not that HiFi, or the wave form is indeed not that like a square wave.
Anyway, next step is to check SPI loop back, to see if MISO pin can read MOSI's output, at 100kHz and also 1MHz.[/i][/color]

4 Analog Channel Scope to display SPI Clk, Mosi, Miso, CE0/1

Today I received a weekly newsletter from Element14 eMarketing, recommending their goodies, including the following scope:

It looks strange, but techies love the Raspberry Pi, a customizable, open-source computer system designed to help people learn and practice basic computer coding. “I feel like it does the same thing for me that Legos do for my nephew,” says Dan Sterba, a data analyst whose wife, Nina, bought him a Raspberry Pi a few years ago. He likes that it lets him build something from scratch and figure out how it works. “The first thing I made was a Super Nintendo emulator. Then I set something up to turn the lights on and off ... Now I’m getting into smart-home stuff ...”

Python
The growth of software demand in the fields of artificial intelligence and data science is a good opportunity for devs to branch out into new-generation technologies. Specifically, programmers with knowledge in using Python can transfer their skills in machine learning as well as web or software development.

Python’s popularity has spiked over recent years. In fact, Reddit, DropBox, and NASA are only some of the most popular organizations that are using Python to run their website, projects, or services.

Python also plays nice with Raspberry Pi, which is a line of single-board computers that are used to teach basic computer science skills among children in developing countries.

Scala
Some programmers describe Scala as a better alternative to Java because it offers a way for developers to write better codes and improve how a particular program performs. Developers who support Scala say this particular programming language has less restrictions and is less tedious to use, potentially reducing your developers’ frustrations when working on dev projects. Scala is also said to be the programming language of choice among several tech companies, including Apple, LinkedIn, Netflix, and Twitter....

The scope show that the SPI at 1MHz still looks OK, expect the square waves have round corners. I am not sure if it is because my old scope of 100MHz, 1GSa/s is not that HiFi, or the wave form is indeed not that like a square wave.
4 Analog Channel Scope to display SPI Clk, Mosi, Miso, CE0/1
I read that their [element14's] cheapest 4 analog channels scope is HK$14k, and as usual, four or five times than me, a poor hobbyist can afford!
The scope I have been using for the last 5 years is Atten ADS1102CAL which I bought at the 2013 price of CN¥2,200.ATTEN ADS1102CAL+ 100MHz 1GSa/s 2013Jun CN¥1,500https://item.taobao.com/item.htm?spm=a2 ... t=9#detail
I am now thinking of getting the following.RIGOL DS1054Z 50MHz 4channel ¥2,320https://detail.tmall.com/item.htm?_u=b3 ... 6224248671
The 28 Best [Xmas] Gifts for Boyfriends and Husbands, According to Boyfriends and Husbands
CanaKit Raspberry Pi 3 B+ (B Plus) with Premium Clear Case and 2.5A Power Supply $55 at Amazon