Skip to content

Commit 493e9cc

Browse files
committed
bak
1 parent a77b7e3 commit 493e9cc

12 files changed

+220
-41
lines changed

ciro-santilli-s-hardware.bigb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ https://www.amazon.co.uk/dp/B0CL41RG93
8080

8181
https://www.amazon.co.uk/dp/B0B76VGXYH
8282

83+
<MicroPython> driver: https://github.com/Danielerikrust/LCD-20x4-Feed
84+
8385
= ELEGOO Upgraded Electronics Fun Kit
8486
{c}
8587
{parent=Electronic components}
@@ -120,10 +122,15 @@ https://www.amazon.co.uk/dp/B0B76VGXYH
120122
* Buttons
121123
* CDS-55 Photoresistor
122124
* Electrolytic Capacitor
123-
* MF52D 103f 3950 thermistor
125+
* Focusens MF52D 103f 3950 thermistor. Beta value 25/50 Celcius: 3950. R_25: I measured 9.61 k Ohms. The number 103 they document as:
126+
* digit 1: code of dimension
127+
* digit 2: rated resistance
128+
* digit 3: fills with its precision symbol
129+
These descriptions are weird, but ChatGPT has the theory that the first two digits are actual values, and the last is multiplier, so $10 \times 10^3$ which makes 10k.
130+
but I have no idea how that maps to 10 k Ohms.
124131
* PN2222 General Purpose Transistor
125132
* Passive buzzer
126-
* 3386p Bourns Precision Potentiometer - 1 103T: 10 Ohms to 2 mega Ohms. TODO part broken? Multimeter measures fixed 10 kOhms no matter where I set it
133+
* 3386p Bourns Precision Potentiometer - 1 103T: from 0 to 10k Ohms, measured with multimeter. According to the manual the "103" mean 10 k oms, which is consistent with our measurement. "P 103" is etched into the part.
127134
* <LEDs>:
128135
* White LED 10x
129136
* Kingbright RGB LEDs 10x red, green, yellow, blue:

cirosantilli.github.io.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"Czochralski",
5858
"Deeptech",
5959
"deletionist",
60+
"devboard",
6061
"Dietterich",
6162
"Disqus",
6263
"distro",
@@ -148,6 +149,7 @@
148149
"microarray",
149150
"microbenchmark",
150151
"Microbotics",
152+
"Microcontroller",
151153
"microfilament",
152154
"Microtubule",
153155
"minicolumn",
@@ -219,6 +221,7 @@
219221
"Toffoli",
220222
"translocator",
221223
"Transmembrane",
224+
"treshold",
222225
"TSMC",
223226
"Tuttle",
224227
"UCSB",

computer-hardware.bigb

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,34 @@ It is interpreted. It actually implements a Python (-like ?) interpreter that ca
10181018

10191019
As a result, it is both very convenient, as it does not require a C toolchain to build for, but also very slow and produces larger images.
10201020

1021+
= Run MicroPython on X
1022+
{c}
1023+
{parent=MicroPython}
1024+
1025+
= MicroPython example
1026+
{c}
1027+
{parent=MicroPython}
1028+
1029+
Under: \a[micropython]
1030+
1031+
= micropython/blink_gpio.py
1032+
{file}
1033+
{parent=MicroPython example}
1034+
1035+
Toggle pin 0 twice per second. This could be used for example to blink LED on pin 0 once per second with this test circuit:
1036+
1037+
``
1038+
BOARD__1gp0____3gnd
1039+
| |
1040+
R_2k |
1041+
| |
1042+
+-aLEDc-+
1043+
``
1044+
1045+
Tested on:
1046+
1047+
* <RPI Pico W>
1048+
10211049
= Microcontroller vs CPU
10221050
{parent=Microcontroller}
10231051
{wiki}
@@ -2470,7 +2498,7 @@ Serial from `cat /proc/cpuinfo`: 00000000c77ddb77
24702498
= Raspberry Pi Pico
24712499
{c}
24722500
{parent=Raspberry Pi}
2473-
{tag=Microcontroller}
2501+
{tag=Microcontroller devboard}
24742502
{title2=2021}
24752503

24762504
Some key specs:
@@ -2501,9 +2529,10 @@ and uses picozero specific code. Rather, just use our examples from \a[rpi-pico-
25012529
= Flash the Raspberry Pi Pico
25022530
{parent=Raspberry Pi Pico getting started}
25032531

2504-
This is a major design flaw, that the only easy default way is that you have to unplug, press bootsel, replug.
2532+
This is a major design flaw, that the only easy default way is that you have to unplug, press bootsel, replug:
25052533
* https://forums.raspberrypi.com/viewtopic.php?t=328795
25062534
* https://www.reddit.com/r/raspberrypipico/comments/p9kmub/did_you_get_sick_of_unplugging_and_replugging/
2535+
* https://raspberrypi.stackexchange.com/questions/149006/how-to-load-binary-into-raspberry-pi-pico-only-with-cli-without-gui
25072536

25082537
= picotool
25092538
{parent=Flash the Raspberry Pi Pico}
@@ -2605,6 +2634,10 @@ It is however possible to solder it yourself on <Raspberry Pi Pico W>.
26052634
{parent=Raspberry Pi Pico variant}
26062635
{title2=2022}
26072636

2637+
= RPI Pico W
2638+
{c}
2639+
{synonym}
2640+
26082641
Datasheet: https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf
26092642

26102643
Pinout: https://datasheets.raspberrypi.com/picow/PicoW-A4-Pinout.pdf
@@ -2707,14 +2740,15 @@ Examples at: <Raspberry Pi Pico W MicroPython example>.
27072740

27082741
An upstream repo at: https://github.com/raspberrypi/pico-micropython-examples
27092742

2710-
Our examples at: \a[rpi-pico-w/upython].
2743+
Some generic Micropython examples most of which work on this board can be found at: <MicroPython example>{full}.
2744+
2745+
Pico W specific examples are under: \a[rpi-pico-w/upython].
27112746

27122747
The examples can be run as described at <Program Raspberry Pi Pico W with MicroPython>.
27132748

27142749
* \a[rpi-pico-w/upython/led_on.py]: turn on-board LED on and leave it on forever. Useful to quickly check that you are still able to update the firmware.
27152750
* \a[rpi-pico-w/upython/led_off.py]: turn on-board LED off and leave it off forever
27162751
* \a[rpi-pico-w/upython/pwm.py]: <pulse width modulation>. Using the same circuit as the <rpi-pico-w/upython/blink_gpio.py>{file}, you will now see the external LED go from dark to bright continuously and then back
2717-
* \a[rpi-pico-w/upython/adc.py]: <analog-to-digital converter>. The program prints to the <UART> the value of the ADC on GPIO 26 once every 0.2 seconds. The onboard LED is blinked as a <heartbeat (computing)>. The hello world is with a <potentiometer>: extremes on GND and VCC pins of the Pi, and middle output on pin 26, then as you turn the knob, the uart value goes from about 0 to about 64k.
27182752

27192753
= rpi-pico-w/upython/blink.py
27202754
{file}
@@ -2731,15 +2765,7 @@ The <Micropython> code needs to be changed from the <Raspberry Pi Pico 1>, https
27312765
{parent=Raspberry Pi Pico W MicroPython example}
27322766
{tag=LED blinker}
27332767

2734-
Toggle GPIO pin 0 on and off twice a second. Also toggle the on-board LED and print to UART for correlation. You can see this in action e.g. by linking an LED between pin 0 and one of the GND pins of the Pi, and the LED will blink. Circuit:
2735-
2736-
``
2737-
RPI_PICO_W__1gp0____3gnd
2738-
| |
2739-
R_2k |
2740-
| |
2741-
+-aLEDc-+
2742-
``
2768+
Same as the more generic <micropython/blink_gpio.py>{file} but with the onboard LED added.
27432769

27442770
= rpi-pico-w/upython/uart.py
27452771
{file}
@@ -2760,6 +2786,30 @@ screen /dev/ttyUSB0 9600
27602786
``
27612787
and a counter shows up there just fine!
27622788

2789+
= rpi-pico-w/upython/adc.py
2790+
{file}
2791+
{parent=Raspberry Pi Pico W MicroPython example}
2792+
{tag=LED blinker}
2793+
2794+
\a[rpi-pico-w/upython/adc.py]: <analog-to-digital converter>.
2795+
2796+
The program continuously prints to the USB the value of the ADC on GPIO 26 once every 0.2 seconds.
2797+
2798+
The onboard LED is blinked as a <heartbeat (computing)>.
2799+
2800+
The hello world is with a <potentiometer>: extremes on GND and VCC pins of the Pi, and middle output on pin GIO26, then as you turn the knob, the uart value goes from about 0 to about 64k.
2801+
2802+
The 0 side is quite noisy and varies between 0 and 300 for some reason.
2803+
2804+
In <Ciro's ASCII art circuit diagram notation>:
2805+
``
2806+
RPI_PICO_W__gnd__gpio26__5v
2807+
| | |
2808+
| | |
2809+
| | |
2810+
P__1____2_______3
2811+
``
2812+
27632813
= Program Raspberry Pi Pico W with C
27642814
{parent=Program Raspberry Pi Pico W with X}
27652815
{tag=MicroPython}

electronics.bigb

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,15 @@ Asymmetric components have multiple letters indicating different ports. The capi
217217
``
218218
DC_10---R_10---G
219219
``
220-
If the voltage is not given, it is assumed to be a <potentiometer>.
220+
If the voltage is not given, it is assumed to be a variable voltage power supply.
221221
* `LED`: same as diode
222+
* `I`: <electric current> source. Ports:
223+
* `s`: electron source
224+
* `d`: electron destination
225+
* `P`: <potentiometer> source. Ports:
226+
* `1`: one of the sides
227+
* `2`: the middle
228+
* `3`: the other side
222229
* `T`: <transistor>. The ports are `sgTd`:
223230
* `s`: source
224231
* `g`: gate
@@ -239,9 +246,6 @@ Asymmetric components have multiple letters indicating different ports. The capi
239246
--Tsgd--
240247
|
241248
``
242-
* `I`: <electric current> source. Ports:
243-
* `s`: electron source
244-
* `d`: electron destination
245249
* `V`: <Voltmeter>. Ports:
246250
* `p`: positive
247251
* `n`: negative
@@ -670,6 +674,12 @@ It resists to change in <electric current>. Well seen at: <video LC circuit by E
670674
{parent=Resistor}
671675
{wiki}
672676

677+
Variable <resistance> element.
678+
679+
\Image[https://upload.wikimedia.org/wikipedia/commons/0/0a/Electronic-Component-Potentiometer.jpg]
680+
681+
\Image[https://upload.wikimedia.org/wikipedia/commons/1/19/Potentiometer_symbol.svg]
682+
673683
= Electrical resistance and conductance
674684
{parent=Resistor}
675685
{wiki}
@@ -680,6 +690,9 @@ It resists to change in <electric current>. Well seen at: <video LC circuit by E
680690
= Electrical resistance
681691
{parent=Electrical resistance and conductance}
682692

693+
= Resistance
694+
{synonym}
695+
683696
= Drude model
684697
{c}
685698
{parent=Electrical resistance}
@@ -1006,20 +1019,21 @@ Breadboards are a thing of beauty and wonder.
10061019
{synonym}
10071020
{title2}
10081021

1022+
= <Microcontroller> devboard
1023+
{parent=Microprocessor development board}
1024+
10091025
= Arduino
10101026
{c}
1011-
{parent=Microprocessor development board}
1027+
{parent=Microcontroller devboard}
10121028
{wiki}
10131029

10141030
= Micro Bit
10151031
{c}
1016-
{parent=Microprocessor development board}
1032+
{parent=Microcontroller devboard}
10171033
{title2=2016}
10181034
{title2=BBC Micro Bit}
10191035
{wiki}
10201036

1021-
<Zephyr> support: https://docs.zephyrproject.org/2.7.0/boards/arm/bbc_microbit/doc/index.html
1022-
10231037
<Bluetooth> support: not enough <RAM> for it, though in principle its chip/<transceiver> could support it! https://microbit-micropython.readthedocs.io/en/v1.0.1/ble.html
10241038

10251039
Supported editors: https://microbit.org/code/
@@ -1096,9 +1110,41 @@ and the program starts executing immediately after flash ends.
10961110

10971111
You can restart the program by clicking the reset button near the USB. When you push down the program dies, and it restarts as soon as you release the button.
10981112

1099-
= Compile MicroPython code for Micro Bit locally
1113+
= Program the Micro Bit with X
11001114
{parent=Micro Bit}
11011115

1116+
= Run <Zephyr> on Micro Bit
1117+
{parent=Program the Micro Bit with X}
1118+
{tag=Run Zephyr on X}
1119+
1120+
Docs: https://docs.zephyrproject.org/2.7.0/boards/arm/bbc_microbit/doc/index.html
1121+
1122+
Build worked:
1123+
``
1124+
west build -d build/microbit/hello_world -b bbc_microbit samples/hello_world
1125+
``
1126+
but flash failed:
1127+
``
1128+
west flash -d build/microbit/hello_world
1129+
``
1130+
Related: https://mattoppenheim.com/2018/06/24/using-udev-to-remove-the-need-for-sudo-with-the-bbc-microbit
1131+
1132+
The build also generates a .hex file by default, and we've tried to flash it manually with:
1133+
``
1134+
cp build/microbit/hello_world/zephyr/zephyr.hex /media/ciro/MICROBIT/
1135+
``
1136+
but we failed to see it do anything with <zephyr/blink_gpio.c>{file}, so not sure if the flashing was broken or if the code was broken, or if we didn't find the IO pins correctly.
1137+
1138+
= Run MicroPython on Micro Bit
1139+
{parent=Program the Micro Bit with X}
1140+
{tag=Run MicroPython on X}
1141+
1142+
Bibliography:
1143+
* https://tech.microbit.org/software/micropython/
1144+
1145+
= Compile MicroPython code for Micro Bit locally
1146+
{parent=Run MicroPython on Micro Bit}
1147+
11021148
* https://stackoverflow.com/questions/73425359/is-it-possible-to-compile-microbit-python-code-locally
11031149
* https://stackoverflow.com/questions/52691853/generating-micropython-python-code-hex-file-from-commandline
11041150

@@ -1114,11 +1160,9 @@ What that does is:
11141160
* join it up with a prebuilt firmware that ships with uflash which contains the MicroPython interpreter
11151161
* flashes that
11161162

1117-
To build your own firmware see:
1163+
To build your own firmware see: <Compile MicroPython code for Micro Bit locally on Ubuntu 22.04 with your own firmware>
11181164

1119-
Got it working: <Compile MicroPython code for Micro Bit locally on Ubuntu 22.04 with your own firmware>
1120-
1121-
= Compile MicroPython code for Micro Bit locally on Ubuntu 22.04 with your own firmware
1165+
= Compile MicroPython code for Micro Bit locally on <Ubuntu 22.04> with your own firmware
11221166
{parent=Compile MicroPython code for Micro Bit locally}
11231167

11241168
TODO didn't manage from source <Ubuntu 22.04>, their setup bitrotted way too fast... it's shameful even. Until I gave up and went for the magic <Docker> of + https://github.com/bbcmicrobit/micropython[], and it bloody worked:
@@ -1219,7 +1263,7 @@ bibliography:
12191263

12201264
= Program the Micro Bit in C
12211265
{c}
1222-
{parent=Micro Bit}
1266+
{parent=Program the Micro Bit with X}
12231267
{tag=C (language)}
12241268

12251269
https://stackoverflow.com/questions/73877965/how-to-compile-c-c-code-into-a-hex-file-for-the-bbc-microbit

micropython/blink_gpio.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Blink LED on pin 0. Tested on: RPI Pico W
2-
31
from machine import Pin
42
from time import sleep
53

rpi-pico-w/upython/adc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from machine import ADC, Pin
2-
import time
2+
from time import sleep
33

4-
led = machine.Pin('LED', machine.Pin.OUT)
4+
led = Pin('LED', Pin.OUT)
55
adc = ADC(Pin(26))
66

77
while True:
88
print(adc.read_u16())
99
led.toggle()
10-
time.sleep(0.2)
10+
sleep(0.2)

rpi-pico-w/upython/blink.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import machine
1+
from machine import Pin
22
import time
33

4-
led = machine.Pin('LED', machine.Pin.OUT)
4+
led = Pin('LED', Pin.OUT)
55
# For Rpi Pico (non-W) it was like this instead apparently.
66
# led = Pin(25, Pin.OUT)
77

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# https://github.com/Danielerikrust/LCD-20x4-Feed
2+
# https://github.com/Danielerikrust/LCD-20x4-Feed/blob/CH9121/LCD_Demo.py
3+
4+
import time
5+
from machine import I2C, Pin
6+
from LCD_Display import LcdApi, I2CLcd
7+
8+
"""LCD Section"""
9+
i2c = I2C(0, sda=Pin(20), scl=Pin(21), freq=400000) #GPIO 20 & 21 have no other function but I2C
10+
devices = i2c.scan()
11+
lcd = I2CLcd(i2c, devices[0], 4, 20) #For 4 row x 20 column LCDs
12+
#lcd = I2CLcd(i2c, devices[0], 2, 16) #For 2 row x 16 column LCDs
13+
print(lcd)
14+
# TODO: display turns on, recognizes I2C since lcd[0] variable not blow up, but nothing is showing up...
15+
lcd.topdata("THIS REMAINS STATIC")
16+
time.sleep(1)
17+
lcd.feed("^ These")
18+
time.sleep(1)
19+
lcd.feed("^^ Lines")
20+
time.sleep(1)
21+
lcd.feed("^^^ Feed")
22+
time.sleep(1)
23+
lcd.feed("^^^^ Up")
24+
time.sleep(1)
25+
lcd.feed("as you add new ones")

0 commit comments

Comments
 (0)