{"id":23864475,"url":"https://github.com/ibebbs/xmasstar","last_synced_at":"2026-05-17T03:46:42.410Z","repository":{"id":148899901,"uuid":"226525500","full_name":"ibebbs/XmasStar","owner":"ibebbs","description":"A .NET Core controller for the ModMyPi Programmable Christmas Tree Star","archived":false,"fork":false,"pushed_at":"2019-12-07T15:23:06.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T15:47:03.579Z","etag":null,"topics":["dotnet-core3","iot","raspberry-pi"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/ibebbs.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":"2019-12-07T14:18:10.000Z","updated_at":"2019-12-07T15:23:08.000Z","dependencies_parsed_at":"2023-07-17T00:16:16.128Z","dependency_job_id":null,"html_url":"https://github.com/ibebbs/XmasStar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ibebbs/XmasStar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibebbs%2FXmasStar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibebbs%2FXmasStar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibebbs%2FXmasStar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibebbs%2FXmasStar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ibebbs","download_url":"https://codeload.github.com/ibebbs/XmasStar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ibebbs%2FXmasStar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33127002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"online","status_checked_at":"2026-05-17T02:00:05.366Z","response_time":107,"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":["dotnet-core3","iot","raspberry-pi"],"created_at":"2025-01-03T08:26:26.827Z","updated_at":"2026-05-17T03:46:42.393Z","avatar_url":"https://github.com/ibebbs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Christmas Star vs .NET Core\n\nA .NET Core controller for the [ModMyPi Programmable Christmas Tree Star](https://github.com/modmypi/Programmable-Christmas-Star)\n\n## Background\n\nA while ago, I submitted [this suggestion](https://github.com/dotnet/iot/issues/771) to the [dotnet/iot](https://github.com/dotnet/iot) repository on Github. My idea was too provide functionality that would allow a PC to remotely control the GPIO pins on a Raspberry Pi running the ['pigpiod' daemon](https://gpiozero.readthedocs.io/en/stable/remote_gpio.html). The suggestion was well received so I submitted [this PR](https://github.com/dotnet/iot/pull/875) providing an initial implementation. This garnered some excellent feedback which, unfortunately, I haven't yet had a chance to implement so the PR is still pending.\n\nThen, a week or so ago, The Pi Hut put the [Raspberry Pi Christmas Tree Star](https://thepihut.com/products/raspberry-pi-christmas-tree-star) up for sale at ~£7. As most who know me know will tell you, I'm all for any opportunity to add tech to... well.... pretty much anything so, as we were about to go purchase our (locally and responsibly grown) Xmas tree, I thought this would be a fun play-thing.\n\nThis repository shows how the functionality I added to the dotnet/iot repository can be used to remotely control this star.\n\nFeel free to play. I would very much welcome any additional patterns for the star or suggestions for improvements.\n\n## Security\n\n**A quick note on security**: When you [enable remote connections](https://gpiozero.readthedocs.io/en/stable/remote_gpio.html#enable-remote-connections) on the Pi, connections can be made to the Pi _**without any authentication at all**_. Therefore please only use this approach on a private network; an internet connected, compromised Raspberry Pi can provide quite a comprehensive entry point to your network!\n\n## Solution\n\nThe solution is comprised of several projects:\n\n### Star.Core\n\nThis project provides a `Star` class which connects to the 'pigpiod' daemon running on a Rasperry Pi Zero at a specific IP address and provides a `WriteAsync(uint frame)` method for controlling the LED's on the star. The `WriteAsync` method converts the specified 32-bit unsigned integer into a collection of 25 pin assignements via bitmasking as shown below:\n\n|Bit|32|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9 |8 |7 |6 |5 |4 |3 |2 |1 |\n|---|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|\n|BCM|nc|nc|nc|nc|nc|nc|nc|25|24|15|18|23|14|3 |4 |17|27|22|10|9 |11|5 |6 |13|19|26|16|20|21|12|7 |8 |\n\nSuch that a 32-bit value of '00000001010101010101010101010101' would result in every other LED on the Star being lit.\n\nNOTE: As the Pigpio implementation isn't currently available in the [Iot.Device.Bindings](https://www.nuget.org/packages/Iot.Device.Bindings/) (due to the PR not being ready to merge) locally build assemblies have been included in the `.\\lib` directory.\n\n### Star.Marching.Console \u0026 Star.Twinkle.Console\n\nThese two projects run as a console application and show how to use the Star.Core library to display patterns on Star.\n\n### Star.Mqtt.Console\n\n#### Description\n\nThis project employs the [generic host](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) to reliably run a service from within a docker container. The service was designed to do two things:\n\n1. Display frames received from an MQTT broker (as a 4 byte buffer) on the star.\n2. Generate and display patterns on the star when no message has been received from MQTT for 10 seconds.\n\nIt can be configured by supplying the following environment variables:\n\n**Star:Pi:Host** - The IP address of the Raspberry Pi broker running the 'pigpiod' daemon  \n**Star:Pi:Port** - The Port to connect to the Raspberry Pi on (defaults to 8888)  \n**Star:Mqtt:Broker** - The IP address of the MQTT broker to receive frames from  \n**Star:Mqtt:Port** - The Port to connect to the MQTT broker on (defaults to 1883)  \n**Star:Mqtt:Topic** - The Topic to receive frames from (defaults to 'home/xmastree')\n\n#### Docker\n\nA dockerfile is provides so that the Star.Mqtt.Console application can be run from with docker. It can be build by running the following command from the '$\\src' directory (relative to repository root):\n\n```\ndocker build -f .\\Star.Mqtt.Console\\Dockerfile -t star:latest .\n```\n\nAnd then run with the following command:\n\n```\ndocker run -e Star:Pi:Host=[IPAddres of Pi] -e Star:Mqtt:Broker=[IP Address of Broker] star:latest\n```\n\nAlternatively a pre-build image can be pulled and run from [dockerhub](https://hub.docker.com/r/ibebbs/xmasstar) using the following:\n\n```\ndocker run -e Star:Pi:Host=[IPAddres of Pi] -e Star:Mqtt:Broker=[IP Address] ibebbs/xmasstar:latest\n```\n\n#### Mqtt\n\nTo quickly test interaction with the Star I use the following Node-Red flow:\n\n![node-red](doc/NodeRed-MQTT.png)\n\n```json\n[\n    {\n        \"id\": \"475a2d52.bc7ebc\",\n        \"type\": \"inject\",\n        \"z\": \"16ce54a.befcb2b\",\n        \"name\": \"\",\n        \"topic\": \"\",\n        \"payload\": \"[0,0,0,0]\",\n        \"payloadType\": \"bin\",\n        \"repeat\": \"\",\n        \"crontab\": \"\",\n        \"once\": false,\n        \"onceDelay\": 0.1,\n        \"x\": 130,\n        \"y\": 340,\n        \"wires\": [\n            [\n                \"3a547207.c894b6\",\n                \"88005ec3.62baf\"\n            ]\n        ]\n    },\n    {\n        \"id\": \"3a547207.c894b6\",\n        \"type\": \"mqtt out\",\n        \"z\": \"16ce54a.befcb2b\",\n        \"name\": \"\",\n        \"topic\": \"home/xmastree\",\n        \"qos\": \"\",\n        \"retain\": \"\",\n        \"broker\": \"adea6257.de843\",\n        \"x\": 360,\n        \"y\": 340,\n        \"wires\": []\n    },\n    {\n        \"id\": \"88005ec3.62baf\",\n        \"type\": \"debug\",\n        \"z\": \"16ce54a.befcb2b\",\n        \"name\": \"\",\n        \"active\": true,\n        \"tosidebar\": true,\n        \"console\": false,\n        \"tostatus\": false,\n        \"complete\": \"payload\",\n        \"targetType\": \"msg\",\n        \"x\": 340,\n        \"y\": 420,\n        \"wires\": []\n    },\n    {\n        \"id\": \"adea6257.de843\",\n        \"type\": \"mqtt-broker\",\n        \"z\": \"\",\n        \"name\": \"Local\",\n        \"broker\": \"192.168.1.24\",\n        \"port\": \"1883\",\n        \"clientid\": \"NodeRed\",\n        \"usetls\": false,\n        \"compatmode\": true,\n        \"keepalive\": \"60\",\n        \"cleansession\": true,\n        \"birthTopic\": \"\",\n        \"birthQos\": \"0\",\n        \"birthPayload\": \"\",\n        \"closeTopic\": \"\",\n        \"closeQos\": \"0\",\n        \"closePayload\": \"\",\n        \"willTopic\": \"\",\n        \"willQos\": \"0\",\n        \"willPayload\": \"\"\n    }\n]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibebbs%2Fxmasstar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibebbs%2Fxmasstar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibebbs%2Fxmasstar/lists"}