{"id":17788697,"url":"https://github.com/devel0/iot-examples","last_synced_at":"2025-04-02T00:29:02.255Z","repository":{"id":122982994,"uuid":"330031984","full_name":"devel0/iot-examples","owner":"devel0","description":"iot examples and wirings","archived":false,"fork":false,"pushed_at":"2025-01-12T16:59:53.000Z","size":2500,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-07T16:14:55.310Z","etag":null,"topics":["arduino","arduino-nano","examples","mbed","pinout","platformio","rotary-encoder","stm32","stm32duino","vscode"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devel0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-15T22:02:41.000Z","updated_at":"2025-01-12T16:59:56.000Z","dependencies_parsed_at":"2024-11-09T16:18:02.439Z","dependency_job_id":"1618312c-1534-4860-bc89-33d2fcaad87a","html_url":"https://github.com/devel0/iot-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fiot-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fiot-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fiot-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devel0%2Fiot-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devel0","download_url":"https://codeload.github.com/devel0/iot-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246734133,"owners_count":20825087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-nano","examples","mbed","pinout","platformio","rotary-encoder","stm32","stm32duino","vscode"],"created_at":"2024-10-27T10:20:52.845Z","updated_at":"2025-04-02T00:29:02.217Z","avatar_url":"https://github.com/devel0.png","language":"C++","readme":"# iot-examples\n\n- [description](#description)\n- [quickstart](#quickstart)\n- [arduino](#arduino)\n  - [examples](#examples)\n  - [development](#development)\n- [platformio](#platformio)\n  - [examples (mbed)](#examples-mbed)\n  - [examples (arduino)](#examples-arduino)\n  - [development](#development-1)\n  - [troubleshoot debug](#troubleshoot-debug)\n- [stm32duino](#stm32duino)\n  - [examples](#examples-1)\n  - [development](#development-2)\n- [hardware](#hardware)\n  - [arduino nano V3](#arduino-nano-v3)\n  - [nucleo-64 F446RE](#nucleo-64-f446re)\n    - [troubleshoot](#troubleshoot)\n  - [nucleo-144 F767ZI](#nucleo-144-f767zi)\n  - [raspberry pi 4](#raspberry-pi-4)\n\n## description\n\nExamples for various\n\n- boards ( arduino nano, stm32 )\n- frameworks ( arduino, stm32duino, mbed )\n- development environments ( vscode arduino, platformio )\n\n## quickstart\n\n```sh\ngit clone https://github.com/devel0/iot-examples\ncd iot-examples\ncode arduino/ledblink\n```\n\n## arduino\n\n### examples\n\n- arduino nano v3\n  - [ds18b20](arduino/arduino-nano-v3/ds18b20)\n  - [ledblink](arduino/arduino-nano-v3/ledblink)\n  - [nano-as-serial-reader](arduino/arduino-nano-v3/nano-as-serial-reader)\n  - [rotary-encoder](arduino/arduino-nano-v3/rotary-encoder)\n  - [signal-gen](arduino/arduino-nano-v3/signal-gen)\n\n### development\n\n- prerequisites\n  - [vscode](https://code.visualstudio.com/)\n  - [arduino ide](https://www.arduino.cc/en/software)\n  - [vscode arduino](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino)    \n- troubleshoot\n  - `avrdude: stk500_getsync() attempt 1 of 10: not in sync` uploading on arduino nano ; set `\"configuration\": \"cpu=atmega328old\",` on `.vscode/arduino.json`\n  - usb permission error on linux: add your user to `dialout` group and set `/etc/udev/rules.d/99-arduino-usb.rules` to automodify arduino serial permission with follow ( check your idVendor:idProduct through `lsusb` ) `SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"1a86\", ATTRS{idProduct}==\"7523\", MODE=\"0666\"`\n- debug\n  - using `Serial.print` through USB cable\n  - C-S-p `Arduino: Upload` then C-S-p `Arduino: Open Serial Monitor`\n- increase build speed setting `.vscode/arduino.json` with `{ \"output\": \"./build\" }`\n\n## platformio\n\n### examples (mbed)\n\n- bluepill F103C8\n  - [hello-world](platformio/bluepill-F103C8/mbed/hello-world)\n- nucleo-64-F446RE\n  - [hello-world](platformio/nucleo-64-F446RE/mbed/hello-world)\n- nucleo-144-F767ZI\n  - [hello-world](platformio/nucleo-144-F767ZI/mbed/hello-world)\n\n### examples (arduino)\n\n- bluepill F103C8\n  - [temp-sensors2](platformio/bluepill-F103C8/arduino/temp-sensors2)\n- ds18b20\n  - [ds18b20](platformio/arduino-nano-v3/ds18b20-nano)\n\n### development\n\n- prerequisites\n  - [vscode](https://code.visualstudio.com/)\n  - [platformio](https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide)\n- troubleshoot\n  - receive `conflicted extension arduino` go to vscode extensions and from arduino ext select from dropdown `Disable (Workspace)`\n  - receive `Error: init mode failed (unable to connect to the target)` on upload ; solve by hit RESET btn until yellow `srst_only separate srst_nogate srst_open_drain connect_deassert_srst` not appears on terminal\n  - receive `[upload] Error` even `Verified OK` ; watch at monitor C-A-s and press RESET to retry start program\n  - receive `Warn : UNEXPECTED idcode: 0x2ba01477 ; Error: expected 1 of 1: 0x1ba01477` ; can set `upload_flags = -c set CPUTAPID 0x2ba01477` on platformio.ini\n- debug\n  - using `printf` output go to monitor ( C-S-p `PlatformIO: Serial Monitor` ) ; it goes over usb cable used for programming to stlink connector\n  - through C-S-p `PlatformIO: Start Debugging` ( working for platformio 5.0.4 )\n\n### troubleshoot debug\n\n- do a platformio/cleanup before\n\n- with platformio/upload receive\n\n```\nxPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:27)\nLicensed under GNU GPL v2\nFor bug reports, read\n        http://openocd.org/doc/doxygen/bugs.html\ndebug_level: 1\n\nsrst_only separate srst_nogate srst_open_drain connect_deassert_srst\n\nError: init mode failed (unable to connect to the target)\nin procedure 'program'\n** OpenOCD init failed **\nshutdown command invoked\n\n*** [upload] Error 1\n```\n\n- solve that by hitting RESET btn until `srst_only separate srst_nogate srst_open_drain connect_deassert_srst` then release and upload goes fine\n\n- hit F5 to debug ( set a breakpoint on an instruction to check )\n\n- if use `DigitalOut` on alternate function pins SWDIO/SWCLK may have problem during reset just after upload ( for example, avoid to use PA13, PA14 on STM32F446RE as DigitalOut )\n\n## stm32duino\n\n### examples\n\n- bluepill F103C8\n  - [hello-world](stm32duino/bluepill-F103C8/hello-world)\n- nucleo-64-F446RE\n  - [hello-world](stm32duino/nucleo-64-F446RE/hello-world)\n  - [dac](stm32duino/nucleo-64-F446RE/dac)\n- nucleo-144-F767ZI\n  - [hello-world](stm32duino/nucleo-144-F767ZI/hello-world)\n\n### development\n\n- prerequisites\n  - [vscode](https://code.visualstudio.com/)\n  - [arduino ide](https://www.arduino.cc/en/software)\n  - [vscode arduino](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.vscode-arduino)  \n  - https://github.com/stm32duino/Arduino_Core_STM32\n  - https://www.st.com/en/development-tools/stm32cubeprog.html\n  - arm gcc `xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest`\n  - openocd `xpm install --global @xpack-dev-tools/openocd@latest`\n- connect STLINK V2 ( 4 wires 3.3-swdio-swclk-gnd )\n- debug\n  - using `Serial.print`\n    - bluepill: through USB-TTL connected to serial (eg. stm32f103c8 pins A9,A10)\n    - nucleo64/144: through usb cable ( `/dev/ttyACM0` )\n    - then C-S-p `Arduino: Upload` then C-S-p `Arduino: Open Serial Monitor`\n  - with active debugger setting `.vscode/launch.json` ( see [hello-world](stm32duino/hello-world/.vscode/launch.json) example ) then press F5\n- troubleshoot\n  - if receive `Send Event AD7MessageEvent` on debug console try to run corresponding `openocd` with arguments given from debug console to test board connection; may you got `Warn : UNEXPECTED idcode: 0x2ba01477` and `Error: expected 1 of 1: 0x1ba01477` that you can fix in `.vscode/launch.json` by setting `\"debugServerArgs\": \"-f interface/stlink-v2.cfg -c \\\"set CPUTAPID 0x2ba01477\\\" -f target/stm32f1x.cfg\",`\n  - if debugger start but breakpoint still grayed double check `.vscode/arduino.json` and see if `\"configuration\"` contains `opt=ogstd` that is Optimize for Debug (-g) while default is Optimize for Smallest (-Os default) on `opt=osstd`.\n  - board:arduino nano\n    - if upload fails check on `.vscode/arduino.json` if `\"configuration\": \"cpu=atmega328old\"`\n\n## hardware\n\n### arduino nano V3\n\n![pinout](https://raw.githubusercontent.com/devel0/iot-examples/main/wirings/arduino-nano-v3-rot.svg)\n\n- CPU 16Mhz / SRAM 2KB / EEPROM 1KB / FLASH 32KB\n- power supply types\n  - USB cable\n  - `VIN` pin (unregulated 7-12V) to AMS1117-5.0\n  - `5V` pin (regulated 5V)\n- max current\n  - I/O pins (40mA)\n  - `3.3V` pin (50mA) from CH340\n- 2 x hardware interrupt\n- 8 x 10bit ADC\n- 6 x PWM\n\n### nucleo-64 F446RE\n\n![pinout](https://raw.githubusercontent.com/devel0/iot-examples/main/wirings/nucleo64-F446RE.svg)\n\n- CPU 180Mhz / SRAM 128KB / EEPROM 0KB / FLASH 512KB\n- power supply types\n  - USB cable (300mA max)\n  - `VIN` CN6/pin8 or CN7/pin24 (unregulated 7-12V ; max 800mA)\n  - `E5V` CN7/pin6 (regulated 5V ; max 500mA)        \n  - `3V3` CN6/pin4 or CN7/pin12 (regulated 3V3) `[stlink debug unavail]`\n- max current\n  - I/O pins (25mA ; total 120mA)\n  - `3.3V` pin (240mA)\n- hardware interrupt on all digital pin\n- 3 x 12bit ADC\n- 2 x 12bit DAC\n\n#### troubleshoot\n\n- `libusb_open() failed with LIBUSB_ERROR_ACCESS`\n\n```sh\napt install stlink-tools\nsystemctl restart udev\n```\n\n- create `/etc/udev/rules.d/90-stlink.rules` with content\n\n```sh\nSUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"374b\", MODE=\"0666\n```\n\nthen reload udev\n\n```sh\nudevadm control --reload-rules \u0026\u0026 udevadm trigger\n```\n\n### nucleo-144 F767ZI\n\n- [pinout](https://raw.githubusercontent.com/devel0/iot-examples/main/wirings/nucleo144-F767ZI.svg)\n- CPU 216Mhz / SRAM 512KB / EEPROM 0KB / FLASH 2048KB\n- power supply types\n  - USB cable (300mA max)\n  - `VIN` CN8/pin15 or CN11/pin24 (unregulated 7-12V ; max 800mA if VIN=7V ; max 450mA if 9\u003eVIN\u003e7 ; max 250mA if 12\u003eVIN\u003e9)\n  - `E5V` CN11/pin6 (regulated 5V in 4.75-5.25V ; max 500mA)\n  - `3V3` CN8/pin7 or CN11/pin6 (regulated 3V3 in 3-3.6V) `[stlink debug unavail]`\n- max current\n  - I/O pins (25mA ; total 120mA)\n  - `3.3V` pin (420mA)\n- hardware interrupt on all digital pin\n- 3 x 12bit ADC\n- 2 x 12bit DAC\n\n### raspberry pi 4\n\n- [pinout](https://raw.githubusercontent.com/devel0/iot-examples/main/wirings/raspberry-pi-4.svg)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevel0%2Fiot-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevel0%2Fiot-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevel0%2Fiot-examples/lists"}