{"id":13341687,"url":"https://github.com/ariestiyansyah/fitra","last_synced_at":"2026-01-25T10:37:53.468Z","repository":{"id":150108336,"uuid":"147629859","full_name":"ariestiyansyah/fitra","owner":"ariestiyansyah","description":"👩🏻‍💼 Her eyes, her smile. That's where blue skies meet the sunrise ","archived":false,"fork":false,"pushed_at":"2018-09-21T12:24:07.000Z","size":57,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T10:07:03.088Z","etag":null,"topics":["arc-reactor","esp32","micropython-esp32","web-of-things"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ariestiyansyah.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":"2018-09-06T06:47:24.000Z","updated_at":"2024-01-03T11:11:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"b25d66a0-532d-4738-97ad-e05ff83aba03","html_url":"https://github.com/ariestiyansyah/fitra","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariestiyansyah%2Ffitra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariestiyansyah%2Ffitra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariestiyansyah%2Ffitra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ariestiyansyah%2Ffitra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ariestiyansyah","download_url":"https://codeload.github.com/ariestiyansyah/fitra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243125163,"owners_count":20240263,"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":["arc-reactor","esp32","micropython-esp32","web-of-things"],"created_at":"2024-07-29T19:25:43.224Z","updated_at":"2026-01-25T10:37:53.437Z","avatar_url":"https://github.com/ariestiyansyah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fitra - Arc Reactor using ESP32 and Web of Things\n\n\u003cimg width=\"800\" alt=\"screen shot 2018-09-10 at 02 44 46\" src=\"https://user-images.githubusercontent.com/2667489/45268263-8b079900-b4a3-11e8-9c0f-07cea7d30864.png\"\u003e\n\n## Requirements\n\nRequirement tools:\n- SparkFun ESP32 Thing\n- Jumper Male-Male 20cm\n- Battery Lipo 3.7v 1000mAh\n- Rainbow LED WS2812\n- Solder\n- Solder Iron\n\n## HOW TO\n\n### Datasheet and Soldering\n\nThe following datasheet is advised by my friend from SurabayaPy [Tegar Imansyah](https://github.com/tegarimansyah)\n\n![photo6096182430420543507](https://user-images.githubusercontent.com/2667489/45268071-c903bd80-b4a1-11e8-8efd-3f3320a72e40.jpg)\n\nConnect SparkFun and Rainbow LED WS2812 with jumper by using the following\nschema\n\n| SparkFun | Jumper     | LED WS2812 |\n|----------|------------|------------|\n| 13       | Connect to | DIN        |\n| VBAT/VUSB| Connect to | VCC        |\n| GND      | Connect to | GND        |\n\nUse VBAT for battery power and VUSB for USB power\n\n### Flashing Loboris Micropython\n\nClone the fork of Loboris Micropython repository, this repository has been\nupdated to allow PUT command to work with microWebSrv and fix for microWebSocket\nbased on [this](https://github.com/dhylands/MicroPython_ESP32_psRAM_LoBo) branch and latest update from [Loboris](https://github.com/dhylands/MicroPython_ESP32_psRAM_LoBo) master branch\n\n```\n$ git clone https://github.com/ariestiyansyah/MicroPython_ESP32_psRAM_LoBo.git\n```\n\nConfig the micropython and build the Firmware\n```\n$ cd MicroPython_ESP32_psRAM_LoBo/MicroPython_BUILD/\n$ ./BUILD.sh menuconfig\n$ ./BUILD.sh\n```\nFlash it\n```\n$ ./BUILD.sh --port /dev/tty.usbserial-DN03F9EP flash\n```\nSparkFun connected to my mac using `/dev/tty.usbserial-DN03F9EP` port, this will be\ndifferent on each device, check it using following command\n\n```\n$ ls /dev/tty.usbserial*\n```\n\n### Install Gateway\n\nFollow instruction from\n[https://github.com/mozilla-iot/gateway/blob/master/README.md](https://github.com/mozilla-iot/gateway/blob/master/README.md)\nto install Mozilla Gateway in your Raspberry Pi or PC/Mac.\n\n### Web of Things Micropython\n\nClone fitra project\n```\n$ git clone https://github.com/ariestiyansyah/fitra.git\n```\n\nHierarchy of fitra project\n\n```\n.\n├── README.md\n├── config.py\n├── connect.py\n├── main.py\n├── src\n│   ├── neopixel\n│   │   ├── np.py\n│   ├── upy\n│   │   ├── README.md\n│   │   ├── copy.py\n│   │   ├── eventemitter.py\n│   │   ├── logging.py\n│   │   ├── types.py\n│   │   └── uuid.py\n│   └── webthing\n│       ├── action.py\n│       ├── event.py\n│       ├── property.py\n│       ├── server.py\n│       ├── thing.py\n│       ├── utils.py\n│       └── value.py\n├── start.py\n└── webserver.py\n```\n\nRename file `config.example.py` to `config.py`, change variable SSID and PASSWORD value with wifi credentials, for example\n```\nSSID = 'FITRA'\nPASSWORD = 'bahagialah'\n```\n\nSync local files to ESP32 by using [rshell](https://github.com/dhylands/rshell),\nyou can also use ampy :) mine is rhsell.\n\n```\n$ rshell -a --buffer-size=30 -p /dev/tty.usbserial-DN03F9EP\nfitra\u003e rsync -v . /flash\nfitra\u003e repl\n\u003e\u003e\u003e Control-D # Soft reset\n```\n\nYou will see spining LED in neopixel now.\n\n### Adding RGB function and Property\n\nCreate sample display_odd function to display LED in odd number by\n\n```\n# src/neopixel/np.py\ndef display_odd(np, delay=DELAY, color=COLOR, saturation=SATURATION, brightness=BRIGHTNESS, clear=True):\n    for reactor in REACTORS:\n        if reactor % 2 == 1:\n            continue\n        np.setHSB(reactor, color, saturation, brightness, 1, False)\n        np.show()\n        time.sleep_ms(delay)\n    if clear:\n        np.clear()\n```\n\nAdd property to enable it in gateway\n```\n# webserver.py\nself.add_property(\n\tProperty(self,\n\t\t'odd',\n\t\tValue(self.odd, self.oddReactor),\n\t\tmetadata={\n\t\t\t'@type': 'OnOffProperty',\n\t\t\t'label': 'Display Odd Reactor',\n\t\t\t'type': 'boolean',\n\t\t\t'description': 'Turn on the Reactor',\n\t\t}))\n```\n\n### Convert RGB to Hex\n\nThis function contributed by my partner in crime [Ady Rahmat MA](https://github.com/ngurajeka)\n```\n# webserver.py\ndef convertToRgb(self, color):\n    red = int(color[1:3], 16) / 256 * 100\n\tgreen = int(color[3:5], 16) / 256 * 100\n\tblue = int(color[5:7], 16) / 256 * 100\n\treturn (red, green, blue)\n\ndef convertToHex(self, color):\n    return int(hex(int(color[1:], 16)), 16)\n    hex_color = self.convertToHex(self.color)\n    hue, saturation, brightness = self.np.RGBtoHSB(hex_color)\n```\n\n## Lesson Learned\n\nall problems found during the experiment.\n\n### LED on USB power vs Battery power\n\nThe led does not run normally when connected with USB Power, it will run\nsmoothly on battery power.\n\n### Could not enter raw repl\n\n```\nrshell -a --buffer-size=30 -p /dev/tty.usbserial-DN03F9EP                              [19:09:48]\nConnecting to /dev/tty.usbserial-DN03F9EP ...\nb\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x9as' [size: 2555904; Flash address: 0x190000]\\r\\n----------------\\r\\nFilesystem size: 2341888 B\\r\\n           Used: 142080 B\\r\\n           Free: 2199808 B\\r\\n----------------\\r\\n\"\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1186, in connect\n    ip_address = socket.gethostbyname(port)\nsocket.gaierror: [Errno 8] nodename nor servname provided, or not known\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/bin/rshell\", line 11, in \u003cmodule\u003e\n    load_entry_point('rshell==0.0.14', 'console_scripts', 'rshell')()\n  File \"/usr/local/lib/python3.7/site-packages/rshell/command_line.py\", line 4, in main\n    rshell.main.main()\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 2712, in main\n    real_main()\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 2674, in real_main\n    connect(args.port, baud=args.baud, wait=args.wait, user=args.user, password=args.password)\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1192, in connect\n    connect_serial(port, baud=baud, wait=wait)\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1216, in connect_serial\n    dev = DeviceSerial(port, baud, wait)\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1462, in __init__\n    Device.__init__(self, pyb)\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1269, in __init__\n    elif not self.remote_eval(test_unhexlify):\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1379, in remote_eval\n    return eval(self.remote(func, *args, **kwargs))\n  File \"/usr/local/lib/python3.7/site-packages/rshell/main.py\", line 1357, in remote\n    self.pyb.enter_raw_repl()\n  File \"/usr/local/lib/python3.7/site-packages/rshell/pyboard.py\", line 187, in enter_raw_repl\n    raise PyboardError('could not enter raw repl')\nrshell.pyboard.PyboardError: could not enter raw repl\n```\n\n### CPU Halted, lol\n\n```\n/Users/ariestiyansyah/code/research/github/ariestiyansyah/esp32/fitra\u003e repl\nEntering REPL. Use Control-X to exit.\nrepl_serial_to_stdout dev = \u003crshell.main.DeviceSerial object at 0x102a58cc0\u003e\n\u003e\nMicroPython ESP32_LoBo_v3.2.24 - 2018-09-06 on ESP32 Rizky with ESP32\nType \"help()\" for more information.\n\u003e\u003e\u003e\n\u003e\u003e\u003e import machine\n\u003e\u003e\u003e np = machine.Neopixel(machine.Pin(13), 24)\n\u003e\u003e\u003e np.deinit()\n\u003e\u003e\u003e np = machine.Neopixel(machine.Pin(13), 24)\nGuru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.\nCore 1 register dump:\nPC      : 0x400e0027  PS      : 0x00060031  A0      : 0x800e01a8  A1      : 0x3ffb1fb0\nA2      : 0x00000018  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000\nA6      : 0x00000000  A7      : 0x00000004  A8      : 0x0ffd114c  A9      : 0x00000000\nA10     : 0x00000009  A11     : 0x00000000  A12     : 0x00002000  A13     : 0x3ff44024\nA14     : 0x00000000  A15     : 0x00060923  SAR     : 0x0000000b  EXCCAUSE: 0x0000001c\nEXCVADDR: 0x00000018  LBEG    : 0x4000c28c  LEND    : 0x4000c296  LCOUNT  : 0x00000000\nCore 1 was running in ISR context:\nEPC1    : 0x400e0027  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x40083410\n\nBacktrace: 0x400e0027:0x3ffb1fb0 0x400e01a5:0x3ffb1fe0 0x40082779:0x3ffb2010 0x400e03ef:0x00000000\n\nCPU halted.\n\nserial port pyboard closed\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariestiyansyah%2Ffitra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fariestiyansyah%2Ffitra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fariestiyansyah%2Ffitra/lists"}