{"id":20696888,"url":"https://github.com/araobp/can-bus","last_synced_at":"2025-07-29T09:34:21.800Z","repository":{"id":30329190,"uuid":"124622507","full_name":"araobp/can-bus","owner":"araobp","description":"CAN adapter to UART","archived":false,"fork":false,"pushed_at":"2021-11-10T16:15:11.000Z","size":10932,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T20:50:37.058Z","etag":null,"topics":["can-bus","mcp2515","mcp2561","mqtt","pic"],"latest_commit_sha":null,"homepage":"","language":"G-code","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/araobp.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}},"created_at":"2018-03-10T04:38:36.000Z","updated_at":"2024-04-16T10:30:06.000Z","dependencies_parsed_at":"2022-08-07T15:15:12.141Z","dependency_job_id":null,"html_url":"https://github.com/araobp/can-bus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/araobp/can-bus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fcan-bus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fcan-bus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fcan-bus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fcan-bus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/araobp","download_url":"https://codeload.github.com/araobp/can-bus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araobp%2Fcan-bus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267662713,"owners_count":24123927,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["can-bus","mcp2515","mcp2561","mqtt","pic"],"created_at":"2024-11-17T00:15:48.463Z","updated_at":"2025-07-29T09:34:21.767Z","avatar_url":"https://github.com/araobp.png","language":"G-code","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IoT with CAN bus\n\n![pcb_ed](./KiCAD/circuit/v0.2_pcb_3d.jpg)\n\nPrinted circuit design for CAN node\n\n(I have not tested the printed circuit board yet, because I have been too busy in other priority works)\n\n## Motivation\n\nI want to develop very cheap and low power sensor/actuator network with electronic parts sold in [Akizuki-Denshi](http://akizukidenshi.com/catalog/default.aspx), Tokyo.\n\nMost of parts I use are DIP.\n\n## Architecture\n\n### Basic concept\n\nI pursue seamless communications between CAN-bus and MQTT-bus:\n\n![concept](./doc/concept.jpg)\n\n## Specification\n\nThe CAN node consists of one base board and one expansion board.\n\nSee this page for expansion boards: [EXPANSION BOARDS](./EXPANSION_BOARDS.md).\n\n### CAN node base board\n\n|Parameter           |Value                       |Note\n|--------------------|----------------------------|---------------------------|\n|PIC16F1 MCU clock   |32MHz(Internal OSC 8MHz * 4 PLL)                        |\n|UART baud rate      |9600bps (fixed)             |Full-duplex wire-rate is not supported|\n|SPI clock           |2MHz (fixed)                |                           |\n|CAN speed           |Max. 250kHz (default 125kHz)|                           |\n|Oscillator for CAN controller|8MHz (ceramic)     |Murata Ceralock            |\n|Expansion board     |8 pins connected to PIC MCU |                           |\n\n#### Circuit\n\n![Circuit](./KiCAD/circuit/v0.2.jpg)\n\n#### PCB\n\n![pcb](./KiCAD/circuit/v0.2_pcb.jpg)\n\n#### BOM\n\n|Part                      |Akizuki-denshi URL |Price in Yen |Quantity|\n|--------------------------|-------------------|-------------|--------|\n|Microchip PIC16F1825-I/P  |http://akizukidenshi.com/catalog/g/gI-10656/|150|1|\n|Microchip PIC16F18326-I/P |http://akizukidenshi.com/catalog/g/gI-11886/|130|1|\n|Microchip MCP2515         |http://akizukidenshi.com/catalog/g/gI-12030/|160|1|\n|Microchip MCP2561         |http://akizukidenshi.com/catalog/g/gI-12483/|90|1|\n|Murata Ceralock 8MHz      |http://akizukidenshi.com/catalog/g/gP-00153/|35|1|\n|Regiter 51k ohm           |http://akizukidenshi.com/catalog/g/gR-25513/|1|1|\n|Register 10k ohm          |http://akizukidenshi.com/catalog/g/gR-25103/|1|1|\n|Register 120 ohm          |http://akizukidenshi.com/catalog/g/gR-25121/|1|1|\n|Murata capacitor 0.1 micro F|http://akizukidenshi.com/catalog/g/gP-00090/|10|3|\n|Diode 1A                  |http://akizukidenshi.com/catalog/g/gI-08332/|10|1|\n|Toshiba TA48M05F (w/ capacitors)|http://akizukidenshi.com/catalog/g/gI-00451/|100|1|\n|Polyswitch 250mA          |http://akizukidenshi.com/catalog/g/gP-01354|30|2|\n|LED 3mm red               |http://akizukidenshi.com/catalog/g/gI-04780/|20|1|\n|Tactile switch            |http://akizukidenshi.com/catalog/g/gP-08216/|20|1|\n|IC sockets 14pins         |http://akizukidenshi.com/catalog/g/gP-00006/|10|1|\n|IC sockets 18pins         |http://akizukidenshi.com/catalog/g/gP-00008/|10|1|\n|IC sockets 8pins          |http://akizukidenshi.com/catalog/g/gP-00017/|10|1|\n|Pin socket 6pins          |http://akizukidenshi.com/catalog/g/gC-03784/|20|1|\n|Pin socket 4pins          |http://akizukidenshi.com/catalog/g/gC-10099/|20|2|\n|Pin header L shape        |http://akizukidenshi.com/catalog/g/gC-01627/|50|1|\n|Phenix Contact terminal block 2P|http://akizukidenshi.com/catalog/g/gP-08369/|20|1|\n\n### CAN Standard Identifier format\n\nThis implementation supports CAN Standard Frame only (does not support Extended Frame). For home networking, 11bit Standard Identifier suffices.\n\n=\u003e [FORMAT](./doc/FORMAT.md)\n\n### \"CAN adapter to UART\" command list\n\nThis implementation supports CAN adapter functionality for PC and Android.\n\n```\n/// UART2CAN HELP (version 0.11  March 19, 2018) ///\n[Set standard identifier] @i\u003cstandard identifier\u003e\n[Set output mode] {debug: @vd, verbose: @vv, normal: @vn}\n[Enable operation mode] {loopback: @ol, normal: @on}\n     with SID: @ols or @ons\n[Set mask] @m\u003cn\u003e\u003cmask(SID10 ~ SID0)\u003e\n[Set filter] @f\u003cn\u003e\u003cfilter(SID10 ~ SID0)\u003e\n[Set baud rate] @b\u003cbpr\u003e\n[Abort all pending transmissions] @a\n[Dump masks and filters] @F\n[Dump registers] @D\n[Send message] \u003cmessage\u003e\n[Send message beginning with '@' character] @\u003c@message\u003e\n[Receive message] \u003cmessage\u003e will be output\n[Show this help]: @h\n```\nFor example, to receive messages with SID 5, 10 and 15, set masks and filters to the CAN adapter as follows:\n\n```\n@m02047  --\u003e RXM0 0b11111111111\n@f05     --\u003e RXF0 0b00000000101 (SID 5 message to RXB0)\n@f110    --\u003e RXF1 0b00000001010 (SID 10 message to RXB0)\n@m12047  --\u003e RXM1 0b11111111111\n@f215    --\u003e RXF2 0b00000001111 (SID 15 message to RXB1)\n```\n\n---\n## Development environment\n\n- Microchip [MPLAB-X IDE](http://www.microchip.com/mplab/mplab-x-ide) with MCC plugin.\n- [FreeCAD](https://www.freecadweb.org/)\n- [KiCAD](http://kicad.org/)\n- [3D printer BIQU Magician](https://www.biqu.equipment/collections/3d-printer/products/biqu-magician-3d-printer-new-diy-kit-mini-kossel-delta-printing)\n- [RaspberryPi](https://www.raspberrypi.org/)\n\n---\n\n## Development plan and progress\n\n### M1 (completed on March 17, 2018)\n\n![board](./doc/board.jpg)\n\n- Purchased CAN adaptors from Amazon.\n- Evaluate CAN ==\u003e [EVALUATION](./doc/EVALUATION.md).\n- Developed my original ASCII-based protocol over serial for MCP2515. The protocol is mainly for evaluating MCP2515.\n\nAt first, I use [this universal board](http://akizukidenshi.com/catalog/g/gP-08241/) to make a prototype of the CAN adaptor:\n\n![universal board](./doc/universal_board.jpg)\n\nI have finished the first prototype (Marth 25-27, 2018). I have made three boards, and it took eight hours.\n\n![front](./doc/universal_board_front.jpg)\n\n![back](./doc/universal_board_back.jpg)\n\n![daisy_chain](./doc/daisy_chain.jpg)\n\n### M2 (completed on April 1, 2018)\n\n![3d_printed](./doc/3d_printed.jpg)\n\n3D printed enclosure for CAN node\n\n- Purchase three pairs of MCP2515 and MCP2561 in Akihabara.\n- Develop my original CAN adaptor board.\n- Develop [CAN-MQTT gateway](./gateway/gateway.js) on RasPi ~~and OpenWrt~~.\n- Develop [a 3D-printed DIN rail enclosure](./cad/adapter_to_uart.stl) for the board by using [FreeCAD](https://www.freecadweb.org/).\n- ~~Mount all of them on DIN rail (incl. RasPi).~~\n- ~~Add [SLCAN](https://elixir.bootlin.com/linux/v3.4/source/drivers/net/can/slcan.c) that is ASCII-based protocol for SocketCAN.~~\n\n### M3\n\n- Evaluate [PIC16F18326](http://akizukidenshi.com/catalog/g/gI-11886/) that is cheaper than PIC16F1825 and supports two MSSPs.\n- Use KiCAD to redesign the circuit for PIC16F18326.\n- Adopt moduler architecture: base board and sensor/actuator building blocks.\n- Support sensors and actuators: doppler sensor, CdS, servo motor etc.\n\n![requirements](./doc/requirements.jpg)\n\n---\n## Reference\n\n### Datasheet (Microchip/NXP/Murata)\n\n#### Microchip\n- [PIC16F1825](http://ww1.microchip.com/downloads/en/DeviceDoc/41440A.pdf)\n- [MCP2515](http://ww1.microchip.com/downloads/en/DeviceDoc/21801d.pdf)\n- [MCP2561](http://ww1.microchip.com/downloads/en/DeviceDoc/20005167C.pdf)\n- [MCP2515DM-BM](http://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=MCP2515DM-BM)\n\n#### NXP\n- [TJA1050](https://www.nxp.com/docs/en/data-sheet/TJA1050.pdf)\n\n#### Murata\n- [Ceralock](https://www.murata.com/~/media/webrenewal/support/library/catalog/products/timingdevice/ceralock/p17e.ashx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fcan-bus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faraobp%2Fcan-bus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraobp%2Fcan-bus/lists"}