{"id":19832070,"url":"https://github.com/danielmartensson/stm32-plc","last_synced_at":"2025-05-01T16:33:04.519Z","repository":{"id":39662693,"uuid":"397629035","full_name":"DanielMartensson/STM32-PLC","owner":"DanielMartensson","description":"STM32 microcontroller with lots of periferials such as ADC, differential ADC, Input Capture, PWM, USB, Encoder, DAC, Digital Input, RTC, CAN-bus + Alarm etc.","archived":false,"fork":false,"pushed_at":"2024-02-09T12:38:10.000Z","size":62387,"stargazers_count":70,"open_issues_count":0,"forks_count":30,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-02-09T13:56:45.287Z","etag":null,"topics":["c","can-bus","embedded-systems","stm32","usb"],"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/DanielMartensson.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}},"created_at":"2021-08-18T14:25:17.000Z","updated_at":"2024-02-09T13:56:47.145Z","dependencies_parsed_at":"2024-02-09T14:08:59.002Z","dependency_job_id":null,"html_url":"https://github.com/DanielMartensson/STM32-PLC","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/DanielMartensson%2FSTM32-PLC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FSTM32-PLC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FSTM32-PLC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielMartensson%2FSTM32-PLC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielMartensson","download_url":"https://codeload.github.com/DanielMartensson/STM32-PLC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224267670,"owners_count":17283364,"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":["c","can-bus","embedded-systems","stm32","usb"],"created_at":"2024-11-12T11:36:19.157Z","updated_at":"2024-11-12T11:36:20.200Z","avatar_url":"https://github.com/DanielMartensson.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STM32 PLC\n\n![a](https://raw.githubusercontent.com/DanielMartensson/STM32-PLC/main/Documentation/Pinmap.png)\n\nThis project is a PCB bord that has the following measurement and control input/output:\n\n * 12 x ADC at 16-bit resolution for 0-20mA input with programmable gain\n * 5 x Differential ADC at 16-bit for 0-20mA input with programmable gain\n * 3 x DAC at 12-bit with 0-20mA output\n * 8 x PWM for 0-2.2A with N-channel MOSFET\n * 10 x Digital Input\n * 1 x CAN-bus channel\n * 4 x Input Capture for 0 kHz to 10kHz\n * 3 x Encoder for -32768 to 32767 pulses\n * 1 x USB port for connecting with [OpenSourceLogger](https://github.com/DanielMartensson/OpenSourceLogger) and [GoobySoft](https://github.com/DanielMartensson/GoobySoft)\n * 1 x SPI with 3 chip select for ILI9341 LCD with touch\n * 1 x ST-Link V2 connection\n * 1 x RTC clock with two alarms A(date) and B(week day) and a battery holder so the RTC remembers the date and time\n\n## Protection \n * All ADC, Digital Input, Differential ADC, Input Capture and Encoder are high voltage protected with PTC(fall current 30mA) fuse + 3.6v zener diode.\n * All PWM and DAC are high voltage protected with N-channel MOSFET and PNP-transistor and OP-amp. \n * The CAN-bus channel is high voltage peak protected for 3000V under a short time with a TVS-diode. The CAN-bus transmitter itself can hold against -14V to +14V, but the TVS-diode has a limit around 6V. \n\n## Documentation\nThe documentation for the pin map can be found in the `Documentation` folder. Also all the article numbers for each component can be found in at the `DAC ADC PWM IO.sch` file in the `PCB` folder. Just double click on a PCB symbol and see the `Mouser Electronics` article number of the electrical component. \n\n## Calibration\nYes, it's possible to set the calibration to each input in this project. You need to have the ILI9341 touch LCD with SPI bus. Open the `STM32 PLC Pinouts.pdf` and see the connection for the LCD. You can also set the PWM frequency and analog input gain for the ADC and Differential ADC at 16-bit. \n\n## SAE J1939\nThe STM32 PLC has internal SAE J1939 protocol. Made from [Open-SAE-J1939](https://github.com/DanielMartensson/Open-SAE-J1939) repository.\n\n## OpenSourceLogger\nThis is a QT C++ software that you can connect to your STM32 PLC board via the USB and then you can send signals from OpenSourceLogger and recieve signals.\nOpenSourceLogger is a very easy to use logging and controlling software and it stores data at a SQL server. \n\n## GoobySoft\nThis is a ImGui C++ project that do the same as OpenSourceLogger, but it's much better and have more features. The reason why I moved away from QT C++ to ImGui C++ is because\nit's much easier to write a GUI application in C++ by using ImGui instead of QT. With QT, you are stuck with object oriented programming. Everything is a class. \nBut for ImGui, you can choose which type of lever you want to code, I prefer C-style C++ code with a small dose of object oriented programming (if needed). \n\nConsider that I will work on GoobySoft instead of OpenSourceLogger.\n\n## Program \nThe STM32 PLC has a lot of functions you can select by touching the LCD. \n\n * A:Show measurement and time\n * B:Set analog gain\n * C:Set PWM frequencies\n * D:Set analog input calibration\n * E:Set pulses per encoder revolution\n * F:Set date and time and alarm\n * G:Do a PGN request\n * H:Show ECU addresses\n * I:Commanded address\n * J:Show this ECU DM1 codes\n * K:Show other ECU DM1 codes\n * L:Show this ECU DM2 codes\n * M:Show other ECU DM2 codes\n * N:Show this ECU name\n * O:Show other ECU name\n * P:Show this ECU identifications\n * Q:Show other ECU identifications\n * R:SAE J1939 Auxiliary valve command\n * S:Analog in to PWM\n * T:Analog in to analog out\n * U:About STM32 PLC\n\n## How to build this STM32 PLC\n\n 1. Download this repository\n 2. Download \u0026 Install KiCad\n 3. Open the `PCB` folder and open the `.pro` file with KiCAD and greate a `gerber` file of your own choice\n 4. Go to your PCB manufacturer and give them the `gerber` file and let them produce the board for you\n 5. Order the eletrical components from `Mouser Electronics`\n 6. Once you have the eletrical components and your PCB board, it's time to solder them.\n 7. Once the PCB board is finished, then install STM32CubeIDE\n 8. Open the `Code` project and import the `.ioc` project file using STM32CubeIDE\n 9. Flash the board with the `C` code by using ST-Link V2 connection\n 10. Connect the ILI9431 touch LCD and then you are done!\n\n## Software used\n\n * KiCAD: 6.0.7\n * STM32CubeIDE 1.10.1\n\n## Status of the project\nIt's done. I don't plan to update this project. Everything is working and it will remain that way.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmartensson%2Fstm32-plc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielmartensson%2Fstm32-plc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmartensson%2Fstm32-plc/lists"}