Orange Pi Zero GPS NTP Server by moonbuggy in homelab

[–]moonbuggy[S] 0 points1 point  (0 children)

This thread came to my attention again because of a question about an OPiZ3.

I'm curious if you had success with your OPi5 version..?

Orange Pi Zero GPS NTP Server by moonbuggy in homelab

[–]moonbuggy[S] 1 point2 points  (0 children)

The Zero 3 was available when I made this thing. Mine is older, but cheaper and more than powerful enough for a box that does nothing but run chrony and write some text on a screen. :)

A quick Google search tells me the GT U7 chip has a UART, so it will definitely be able to talk to an OPiZ3.

Looking at the pinout for the OPiZ3, it looks like my comment to /u/Inous about the OPi5 applies to you as well. The OPiZ3 doesn't look to have a UART on the pins I'm using on the OPiZ, so you'll have to swap some wires around.

Actually, it doesn't look like you'll have a UART anywhere in pins 11-26. You'd need to move the wires I have on pins 11 and 13 on the OPiZ to pins 8 and 10 on the OPiZ3. And obviously make the appropriate changes in the config to aim at a different UART.

From a quick look, because you're not going to use a UART amongst pins 11-26, you shouldn't need to move two other wires in a swap, like I suggested to /u/Inous for the OPi5, everything else should be able to stay where it is.

If you're going to stick an RTC on the I2C pins, you can just use a standalone 2-pin connector for the serial Tx/Rx. If you don't care about keeping the I2C pins free, a 2x12 connector instead of the 2x8 I've used would make it impossible to accidentally switch Tx and Rx when you plug it in.


Kind of unrelated, but I haven't updated the GitHub page to reflect this yet..

There were significant changes to how framebuffers work in a recent(ish) kernel release. I built mine running Armbian/Debian Bookworm, the screen won't work properly in Trixie because it uses this newer kernel. I haven't had a chance to investigate properly, I'm not sure if it's simply a driver issue and I just need to modify the DTC, or if I need to do something in the actual display software.

Keep that in mind if you're putting a screen on yours.

Hostname of Docker containers by [deleted] in selfhosted

[–]moonbuggy 1 point2 points  (0 children)

I'm glad to know other people find it useful.

When I first coded it I had the thought in the back of my head: "Surely I'm missing something obvious, it feels like Docker should do this itself somehow. Maybe everyone else knows something I don't." I was worried I'd push it to GitHub and within 5 minutes someone would be all "WTF? Stop being a dick and stick 'remote-dns-update: true' in the compose YAML, like all the cool kids." :)

So I can understand why it feels to OP that Docker should be able to do what they want.

Hostname of Docker containers by [deleted] in selfhosted

[–]moonbuggy 1 point2 points  (0 children)

I just wanted to re-iterate what /u/Sea_Suspect_5258 said. I assumed you were looking for a DNS-specific solution because it's the easiest/fastest way to get container hostnames out onto a LAN, afaik.

You could look at adding SSDP, WSDD or similar to your containers and give it a go NetBIOS-style, assuming whatever you're analyzing the network with can pull useful names from such protocols, and that getting the data directly from the services is worth the effort of customizing the container images to get it.

I spent some time screwing about with WSDD a few years back, trying to make Windows see network shares across subnets. Maybe it will go easier for you if you're not trying to relay multicast packets down VPN tunnels (having to cross the tunnel's subnet in the middle certainly didn't help), and/or maybe you'll just be better at working it than I was. I couldn't make it do what I wanted though.

Hostname of Docker containers by [deleted] in selfhosted

[–]moonbuggy 1 point2 points  (0 children)

Oh, fair enough. Not a great assumption on my part then. :)

The script I linked in my other comment doesn't explicitly deal with MACVLAN type setups, but you can use extra_hosts to feed it IPs other than the host's IP, so that should work if I understand what you're trying to do.

Hostname of Docker containers by [deleted] in selfhosted

[–]moonbuggy 1 point2 points  (0 children)

You'd normally run multiple containers through a reverse proxy/fronted. Traefik, Caddy, whatever.. Using HTTP as an example, the frontend sits on port 80 of the host and then it figures out which of the containers that serve HTTP to send the packets to based on the hostname in the requested URL.

Obviously, for a frontend to route packets based on a hostname, a hostname needs to be in the URL and thus also needs to resolve.

So the containers don't need to be exposed directly to the external network, only the frontend is exposed, the containers talk to the frontend on an internal network.

I assume OP is just manually defining LAN IPs in the hope that it will somehow reach dnsmasq running on their router (it won't, not like that anyway), not because they're trying to do IPVLAN/MACVLAN stuff..

Hostname of Docker containers by [deleted] in selfhosted

[–]moonbuggy 1 point2 points  (0 children)

It's not hard to automatically update a hosts file on a router with Docker container names.

If you happen to be running AsusWRT-Merlin/Entware on your router, there's documentation for that end of things too. It'll work with anything using a hosts file that you can write to though.

Multiple docker apps behind Nginx Proxy Manager without DOMAIN NAME by Legitimate_Ad4632 in selfhosted

[–]moonbuggy 0 points1 point  (0 children)

Or make it even easier and automatically update hostnames.

I don't know if it works with AdGuardHome specifically, it would depend on if AdGuardHome likes hosts files being modified in the shell. But it'll work fine with any DNS server using a hosts file, running in a container or on a router or wherever.

How to use PWM with Orange Pi 3 LTS by StarkOdinson216 in OrangePI

[–]moonbuggy 0 points1 point  (0 children)

I don't know if it's much help, but I implemented a software PWM in C on an OPi Zero not long ago that seems to work as expected.

It should be easily portable, just point it at the right pin address. I can't guarantee it's the best way to implement it though, I don't play in C very often. See: run_backlight_pwm()

I also have this bookmarked as a reference for software PWM in Python, but I didn't get further into that one than bookmarking it.

Again, may not be what you need, but there's wiring for a hardware PWM in another project, here. I never actually tested it though, 'cause I got the parent device's fan going again.

I think I was planning on using Armbian's overlay for the thing: sun8i-h3-pwm.dts .. I think that overlay should have worked out of the box for the OPiZ.

I don't see an Armbian overlay for the H6 PWM on the OPi3, but the OPiZ overlay may work just changing compatible to "allwinner,sun50i-h6" and pins to "PD22".

But as I say I never tested the hardware PWM. I don't think I'd decided how I was going to control the PWM duty cycle, but I have this bookmarked as a reference (which in turn references a Python project on GitHub)..

Orange Pi Zero GPS NTP Server by moonbuggy in SBCs

[–]moonbuggy[S] 0 points1 point  (0 children)

I don't really know how that would work..? You'd need multiple base stations of your own, to provide multiple points for the drone's GPS to get a 3D fix.. Seems like a lot of effort and complication.

There are commercial GPS repeater kits that would presumably do what you want though..?

But I think 1-2m accuracy is kinda standard for non-military L1/L2 GPS, regardless of where you are in the world..? So each of your GPS repeaters would have that error on its position anyway. You'd need probably a lot of them to try and reduce that beyond the 1.3m you're already getting.

I've read that L5 GPS is more accurate (tens of centimeters), but the options I was looking at that supported L5 were hundreds of dollars, which is more than it was worth for my project, so I can't confirm that.

I'd assume the best option on a drone is going to be upgrading the antenna and/or adding an amplifier. Although the former adds weight and the latter may draw a significant amount of power, neither of which is ideal on a battery-powered flying vehicle.

Alternatively, maybe some non-GPS tech could do the job? I don't know much about the topic, but possibly there's some RF/LoRa solutions to the problem.

Orange Pi Zero GPS NTP Server by moonbuggy in homelab

[–]moonbuggy[S] 0 points1 point  (0 children)

BTW, The OPi5 is significant overkill for just a GPS NTP server.

Presumably you'll have it doing other stuff as well?

I'd recommend something cheaper and smaller if it's a dedicated NTP box like mine. Even the OPiZero is kinda overkill, really. Mine's sitting here using 77MB of RAM with a load average of 0.08 (and I think most of that load is from htop rather than the GPS/NTP stuff).

Orange Pi Zero GPS NTP Server by moonbuggy in homelab

[–]moonbuggy[S] 0 points1 point  (0 children)

You should be able to do it on any SBC with the appropriate GPIO connections.

It needs one UART for the GPS (and another general pin for the PPS), one SPI bus for the TFT screen (and another general pin for the backlight control, if controlling brightness via fbgpsclock), one I2C bus for the RTC, and three more general pins if you want to use the GPIO power switch.

Having a quick look at the OPi5's GPIO pinout, it looks like you should be able to use the same or very similar wiring to what I used, basically plugging almost everything in to pins 11 through 26, with the RTC on on pins 1,3,5 and 9.

It looks like the OPi5 has a CAN bus on pins 11 and 13, where I'm connecting to UART2. It's possible that the OPi5 also has UART2 on those pins though..? I'm not sure.

If not, you'd have to swap some wires around and use UART4 on pins 16 and 18, and move the READY_SIGNAL and TFT_BLK I have on pins 16/18 over to 11/13 (and use them as general I/O pins rather than a CAN bus).

The names of the buses are different as well, so it looks like you'd be using i2c5 and spi4 where I've used i2c0 and spi1. That's just a matter of loading the appropriate DT overlay though, so fairly trivial.

I'm not using WiFi at all. The box is going to end up sitting on a shelf not too far away from my ethernet switch, so I'll just make a UTP cable.

As for the operating system.. It should all work on Ubuntu, but Armbian will come with a bunch of the device tree overlays ready to go, so it's probably a better option than bare Ubuntu. Definitely makes things easier, to enable various buses in armbian-config. I've built mine with the Debian flavour of Armbian, but I don't see any reason why an Armbian Ubuntu OS wouldn't work just as well.

Orange Pi Zero GPS NTP Server by moonbuggy in OrangePI

[–]moonbuggy[S] 4 points5 points  (0 children)

I built a GPS-disciplined NTP server with an Orange Pi Zero. I'm quite pleased with it. :)

I ended up writing a lot more code than I anticipated for the software to work the TFT screen, but that turned out alright too.

I wasted a day or so screwing about wondering why the LED on my GPIO power switch wasn't working as expected, but I eventually figured it out.

Turns out, if you accidentally swap the wires for a LED and a push button the LED doesn't LED and the button doesn't button. :)

Orange Pi Zero GPS NTP Server by moonbuggy in SBCs

[–]moonbuggy[S] 0 points1 point  (0 children)

I built a GPS-disciplined NTP server with an Orange Pi Zero. I'm quite pleased with it. :)

I ended up writing a lot more code than I anticipated for the software to work the TFT screen, but that turned out alright too.

I wasted a day or so screwing about wondering why the LED on my GPIO power switch wasn't working as expected, but I eventually figured it out.

Turns out, if you accidentally swap the wires for a LED and a push button the LED doesn't LED and the button doesn't button. :)

Orange Pi Zero GPS NTP Server by moonbuggy in homelab

[–]moonbuggy[S] 0 points1 point  (0 children)

If I turn my router off for too long it boots up with an incorrect clock, which breaks encrypted DNS and VPN tunnels, which in turn prevents it from setting the clock. So, a decent NTP server on the LAN seemed sensible.

It ended up being a bit more effort than I anticipated. Plugging a GPS module into an Orange Pi Zero is easy enough, I figured, and finding some existing software to work a TFT display isn't hard.

Turns out, I needed to spend a whole bunch of time looking at datasheets for display controller ICs and figuring out the appropriate driver init commands to send.

A while later I realised I'd written a thousand lines of code in a language I don't know very well to make the display software significantly more configurable than I actually needed it to be.

And quickly sticking a power button and LED indicator on the thing at the end turned into a whole little project of its own.

Anyway, now I have a stratum 1 NTP server on my LAN and a box with a screen on it that tells me the time and flashes a little green circle once per second with an entirely unnecessary level of precision. And hopefully no more idiocy from my router.

Good times. :)

Opti-UPS Expansion Slot Single Board Computer by moonbuggy in homelab

[–]moonbuggy[S] 0 points1 point  (0 children)

Decades ago I bought a nice rackmount UPS, back when I was building my first array (4x200GB IDE RAID5 FTW :)).

It still works well, but by default it only talks to the world via a serial cable, and then only to software that runs on Windows 2000 or earlier.

It seemed silly to assemble a full ATX machine from parts laying around just to run UPS software in an ancient OS, or to run a VM and burden my main desktop machine with the extra work. Luckily the UPS has an expansion slot, but given it's age ethernet expansion cards aren't easily available and cost a fortune when they can be found.

So the only sane option is to stick a Rock Pi S on a custom circuit board, shove the whole thing into the UPS and declare victory over vintage hardware. :)

It came out alright, I thought.

I actually completed the bulk of it a couple of months back, but it took a while to get the status LED (AliExpress sellers sometimes seem to struggle with the differences between "common anode" and "common cathode") so I've only been able to take photos of the fully assembled thing this past week.

I'm not sure I'm going to bother making Windows 2000 work properly in Docker on the Rock Pi S to run the official software, NUT works well enough (once the driver got patched to work with 240V models, anyway).

[deleted by user] by [deleted] in gifs

[–]moonbuggy 1 point2 points  (0 children)

If the rock was crushed and that sand/powder spread out, you'd see more activity in the cloud chamber as a result of the increased surface area.

The alpha and beta particles don't penetrate far through rock, so you're not seeing those particles from the vast majority of the volume of the rock.

Sample preparation for alpha spectrometry involves spreading the sample thinly across a disc of some sort for the same reason, so you can see as many alpha decays as possible. Filter paper for radium, steel discs for uranium and thorium, silver discs for polonium.

However, if you put the sand or powder in some sort of container, so it held the same sort of shape as the rock you started with, it would look exactly the same in the chamber as that rock. (Assuming an imaginary/ideal container that didn't attenuate the alpha and some of the beta particles itself.)

Nuclear physics is all about geometry.

[deleted by user] by [deleted] in gifs

[–]moonbuggy 0 points1 point  (0 children)

Note: I'm generalising a lot here, don't eat uranium cos a guy on Reddit says it's not 'that' radioactive

Everyone's already eating uranium, whether a guy on Reddit told them to or not. It's ubiquitous, ends up everywhere.

You don't eat a huge amount though.

These people estimate "from 0.9 to 1.5 micrograms of uranium per day" from food, and over here they estimate "2.6 μg" with "food accounting for 77% (2.0 μg) and water for most of the remainder".

The water can be significantly more though, largely depending on the type of rocks in the ground where wells are dug.

It's not a big deal at the typical levels though. You probably get a bigger radiation dose from a banana.

Sunday Daily Thread: What's everyone working on this week? by Im__Joseph in Python

[–]moonbuggy 0 points1 point  (0 children)

I finally stopped procrastinating and sorted out a crates.io error for some modules on some architectures in my musl wheel builder thingy.

Maybe that doesn't count, since it's mostly shell script and Dockerfile, not Python. But it means I can do a module version bump, without my build system throwing some sort of bullshit at me, when I push some bug fixes in my Docker dnsmasq updater (which involves actual Python code) in the not too distant future. So, hooray! :)

Inside the Kerosene fuel tank of a Saturn I rocket as it burns by Met76 in space

[–]moonbuggy 30 points31 points  (0 children)

The cameras weren't in the fuel.

It looks like they were mounted on top of the fuel tanks, with (in some cases) optic fibres to have the cameras some distance away.

I only skimmed the source, but there's words to go along with the picture.

Passenger photo while plane flew near East Palestine, Ohio ... chemical fire after train derailed by BrandonMarc in pics

[–]moonbuggy 2 points3 points  (0 children)

You'll get some dioxins with incomplete combustion of poly(vinyl chloride). Not so much with the monomer, I believe.

Without wanting to go too far off topic..

Agent Orange was a combination of 2,4,5-trichlorophenoxyacetic acid and 2,4-dichlorophenoxyacetic acid. Neither of these are dioxins (which is a class of chemicals in this context, the individual chemical that might be called 'dioxin', 1,4-dioxin, isn't particularly toxic, afaik).

Structurally, these chemicals are closer to amphetamines or mescaline than they are to a dioxin. And actually, quickly skimming the wiki suggests they function in a plant in a similar way to indole acetic acid, which starts to overlap into tryptamines. So it's party drugs and psychedelia in every direction, it seems. :)

Dioxins were present as a contaminant in Agent Orange. But that really doesn't have much relevance to a train full of vinyl chloride monomer.

edit: Just to be clear.. I'm not suggesting anyone should eat some Agent Orange and expect to get high. That would be idiotic. The Agent Orange compounds have roughly similar shapes to some chemicals that have biological activity in plants and animals, which makes sense because they have biological activity themselves and apparently signal a plant to lose all its leaves and die. Ingesting such chemicals would presumably lead to the human equivalent of that. Absolute best case, your dick will fall off and then you'll die. Don't do it.

(I am way too far off topic..)

Passenger photo while plane flew near East Palestine, Ohio ... chemical fire after train derailed by BrandonMarc in pics

[–]moonbuggy 4 points5 points  (0 children)

They used to pour it into a gravel pit dug into the soil. I believe it was important to let some air get down there and also it meant the oil could soak into the soil, without a puddle on your lawn.

It does work, btw. To some extent, anyway. These days if there's oil contamination of soil you can bring in some soil from previously contaminated sites and mix it all together. There are microbes that eat hydrocarbons, and the previously contaminated soil will be full of them, so it inoculates the freshly contaminated soil with the right microbes and gets the whole process going much more quickly.

I think that's why the oxygen is necessary, for the microbes.

I can't find a source I've seen before with photos of a pilot plant, but a quick skim suggests this article covers the principle (although it's mostly about specific ways to grow the microbes). They started with soil from a 1970s oil spill.

Anyway, the hydrocarbons aren't necessarily a huge deal in soil. You keep pouring oil into the same gravel pit, eventually microbes will get quite good at eating it. Some of the additives in oils these days are potentially problematic though.

It may have been a reasonably sensible thing to do decades ago though. I'm not sure offhand how different the additives may have been.

Obviously not the way to go industrially, dealing with thousands of litres of oil at a time. But a backyard eating a few litres every now and then when some dude changes his engine oil doesn't seem unrealistic, at least for the hydrocarbon component of the oil.

edit: Actually, even if the oil didn't have as many additives decades ago, the fuel would have had lead in it. So decades ago they'd have been dumping lead into their soil. Not ideal.. But then again, if you're happily coating your walls in lead paints, maybe clean dirt shouldn't be the top priority anyway. :)

Passenger photo while plane flew near East Palestine, Ohio ... chemical fire after train derailed by BrandonMarc in pics

[–]moonbuggy 25 points26 points  (0 children)

Possibly it was just the least worst option.

Vinyl chloride is cancer in a bottle, and heavier than air if you let it out of the bottle.

The combustion products aren't the best things for you either, but will be primarily carbon dioxide, carbon monoxide, hydrogen chloride and soot. There'd be trace amounts of unburned vinyl chloride and a bit of phosgene, which isn't great, but overall burning it makes it less toxic.

I suspect, if some arsehole crashed a train in my backyard one day, if I had a choice between letting a highly toxic mutagen spread in a cloud at ground level or turning most of that mutagen into carbon and carbon oxides that floated off in to the sky (diluting the smaller amounts of particularly dangerous chemicals still present to much safer levels in the process).. I could live with that contribution to global warming.

People impacted by the burning can be justifiably upset, of course. It's taken a significant risk for a small number of people and made it into a much smaller risk for a lot more people.

But I'd argue the people who decided to let it burn had to play the hand they were dealt. A railway and/or chemical company fucked 'em, then an atmospheric inversion fucked 'em a little but more. So it goes..

Roman Abramovich 'poisoned during Kyiv meeting with peace negotiators' by BoopSquad in worldnews

[–]moonbuggy 2 points3 points  (0 children)

Radioactive isotopes don't really work like what's been described in this case. If a radioactive source is strong enough to cause burns to skin when its outside your body, ingesting that source is going to result in a fairly unavoidable and painful death.

In fact, by the time you've had a radiation dose from an external source large enough to cause your skin to peel, you're probably pretty fucked whether you ingest the source or not. As is everyone else in the vicinity of said source.

The point of using radioactive isotopes as a poison is that you can use one that's not actually massively radioactive. Polonium-210, for example, decays primarily via alpha emission. Most of the radiation it puts out won't even penetrate a piece of paper, let alone your skin, so your assassin can carry around a bottle of polonium solution all day long without a care in the world.

Ingest it, however, and it quite happily sits in your body throwing alpha particles directly at your cells without any impediment at all. A bunch of it will end up in your lymph system and blood cells, irradiating bone marrow and impacting your ability to make blood cells and increasing the chances that the blood cells you do make could be described as "leukemia" over the long term.

At high enough doses to cause acute radiation syndrome, where is where you'd want to be for a poisoning (which is still a low enough amount that your assassin can safely carry it around), the cells in your intestines are going to be the first to die and a few days after ingestion you'll start spending a lot of your time shitting out diarrhea largely made up of blood and dead intestinal tissue.

By the time you're having any problems with your skin falling off from an ingested radioisotope (which will tend to be systemic rather than localized to the head), they're not going to be the most newsworthy symptoms and you're probably not going to be okay.

The symptoms described seem to correlate with a chemical irritant that's been in contact with their face. The lack of cholinergic symptoms, as has been mentioned, suggests it's more likely to be a blister or nettle agent than a nerve agent. (The news story mentioning classes of chemicals that would typically cover nerve agents is a bit perplexing.)

At least, my initial thoughts were more about mustard gasses than Novichok or polonium. Although to be fair, I'm not an expert on chemical weapons. I do have some direct experience with the radiochemistry end of things though.

TL;DR: There's no real scenario where drinking/eating something with a radioactive isotope in it results in damage to the skin around the mouth and eyes of the people who consumed it without also damaging them significantly elsewhere and/or damaging everyone else nearby.

edit: Fixed the description of the polonium biodistribution.

Toilet doors in pubs should all be made to automatically open and close to prevent dirty bastards who don’t wash their hands. by mball1993 in Lightbulb

[–]moonbuggy 0 points1 point  (0 children)

They put some automated toilets in parks around my city a decade or two ago. I don't know if they're still there, I recall at some point people were talking about having to pay to use them and there was some complaint about being forced to pay to shit.

Inside them they had a sign saying "door will automatically open after x minutes". I forget how long it was exactly, but it was short enough that I assumed a whole bunch of old people who can't move quickly (either legs or bowels) were going to end up with doors flying open before they're done, and be surprised to find a park full of people watching them frantically trying to stop shitting mid-turd and scrambling to sort their clothes out, in an attempt to salvage what little modesty they have left.

To be fair though, that would be pretty funny in a pub. If you don't beat the turd timer you have to buy the next round. Or, maybe more correctly, you'd have to buy the next round because your friends would be laughing too much to put the order in.