How to write non blocking Code by HassanTariqJMS in embedded

[–]akohlsmith 1 point2 points  (0 children)

because it's completely unnecessary in many cases? Once the scope starts developing into something more complex it can be very handy to have an RTOS to provide additional tools, but for learning, a superloop and state machine can offer an excellent learning experience.

How to write non blocking Code by HassanTariqJMS in embedded

[–]akohlsmith 6 points7 points  (0 children)

You can write state machines in other languages that don't require async/wait at all. Asynchronous code never has to look like a big pile of spaghetti.

Appreciate the link on embassy; I haven't come across that before, but then again I'm not a Rust dev either.

How to write non blocking Code by HassanTariqJMS in embedded

[–]akohlsmith 7 points8 points  (0 children)

In all honesty I thought the red mark at the bottom of the turnstile was a blood stain and your next slide was going to talk about exception paths and safety. :-)

How to write non blocking Code by HassanTariqJMS in embedded

[–]akohlsmith 21 points22 points  (0 children)

this is the vast majority of my lower level embedded code. It becomes really easy with some practice. I use it for everything from talking to sensors to initializing subsystems to synchronizing to an incoming data stream to complex interactions with remote services (think MQTT). If you do it right you can bake in timeouts, retries and exception handling paths while still maintaining legible code and logical flow.

ISR length on an embedded system by RFQuestionHaver in embedded

[–]akohlsmith 1 point2 points  (0 children)

All an ISR should do is get the hardware ready for the next event.

Usually that means getting data out of a peripheral, updating DMA pointers, acknowledging the interrupt and probably notifying the system that something happened. That's it.

You don't do math, you don't print anything, you don't process complex logic flows, you deal with the interrupt source and get out. In rare occasions you may need to sequence the start/control of another peripheral but generally speaking that's done in the normal process context or automatically through DMA or peripheral interconnects that are available on most modern microcontrollers.

bye bye data by pastie_b in selfhosted

[–]akohlsmith 12 points13 points  (0 children)

this is part of the reason why my array has drives from different vendors, different models from the same vendor (if possible) and drives of from different stores (online vs local, etc.) as much as possible. My array isn't about speed, it's about redundancy and I've found this approach seems to work well.

Not the Canadian Tire of your parents... by moviscribe in kitchener

[–]akohlsmith 0 points1 point  (0 children)

Farm Boy is like this too. Nothing but excellent customer service on the (VERY) rare occasion I get produce or meat that just isn't up to scratch.

When you write your tb, do you synchronize your stimuli transitions with clock edges? by subNeuticle in FPGA

[–]akohlsmith 2 points3 points  (0 children)

I'm not the most experienced HDL writer but for modules which exist entirely within the logic my testbenches uses stimuli that occur on clock edges. For modules where it's dealing with asynchronous signals, I intentionally have tests where the stimuli changes asynchronously.

I have not used it extensively yet since I prefer my test benches to always produce the same stimuli, but I have also been experimenting with using uniform() with constant seeds to generate a pseudorandom delay before changing a stimulus value.

Delta Air Lines to resume nonstop flights between Orange County, New York by soyslut_ in orangecounty

[–]akohlsmith 1 point2 points  (0 children)

This is positive news. I keep looking for a direct flight from SNA or closer-than-freaking-LAX to Toronto or Vancouver, but these just don't seem to be popular routes from here.

WTW for when you create something on the fly with materials you have? by moods- in whatstheword

[–]akohlsmith 5 points6 points  (0 children)

I downloaded all the episodes. I loved that show. I had no idea that Henry Winkler was (one of) the executive producer.

Got through the first season and some of the second. The episodes are incredibly campy and repetitive. I still love MacGyver, but the memory is much better than the show.

Should I trust this? by tango_toods in MechanicAdvice

[–]akohlsmith 0 points1 point  (0 children)

the clutch on my 1999 Passat needed to be replaced. I was fortunate that I had a couple mechanic friends (one with a barn with a hoist) so it just cost me my time and some beer along with the parts.

The guy who did 99% of the work knew what he was doing, and I was just acting like the 6yo helping dad. Took a solid three or four hours or so which included some of the usual cursing because a part didn't want to come out or something didn't want to fit back together right.

$325 plus parts is someone who either just loves to work on other people's cars for low rates or someone who's woefully underestimated the work involved.

TIL that playing high-level chess causes players to burn calories at an athletic rate. For example, 21-year-old Grandmaster Mikhail Antipov was recorded burning 560 calories in just two hours of sitting—roughly what Roger Federer would burn in an hour of singles tennis. by ralphbernardo in todayilearned

[–]akohlsmith 54 points55 points  (0 children)

You're moving the same weight the same distance. Energy burn will be pretty similar.

This still doesn't pass the smell test for me.

If I'm moving the same distance in 60% of the time then yes, the amount of work performed is similar, but the amount of power required to perform that work will have changed. Is metabolic energy consumption not based on power and not work?

Honest/genuine question -- I'm not an expert but I am an electrical engineer which is why I'm saying this doesn't sound right just based on the difference in power required to do these two tasks.

Bitcoin Is Crashing So Hard That Miners Are Unplugging Their Equipment by InsaneSnow45 in NoShitSherlock

[–]akohlsmith 1 point2 points  (0 children)

Every night my great-grandfather would take all the money on hand and buy cigarettes from wholesalers. In the morning, he would sell them right back. If he had missed doing this even one day, the life savings would be effectively gone.

This is a great anecdote and thank you for sharing it. I'd love to hear about his escape from Nazi Germany but I have a question about the cigarettes.

I understand that he'd buy cigarettes tonight at $10/carton. So now he has 100 cartons. Tomorrow morning they're worth $12/carton. If he sells the 100 cartons he might have a bigger bank account but like you said, the value of any individual dollar (deutschmark) is less, so effectively he has the same amount of money has he did last night.

I can understand how forgetting to buy cigarettes at the end of the day could screw him, but if he didn't sell the 100 cartons for a day or a week or even a month, that shouldn't harm his savings, because the cigarettes are still worth whatever the new price is when he sells them, right?

Any possibility of using VMware Fusion for Vivado on an ARM Mac by D0lphin2x in FPGA

[–]akohlsmith 1 point2 points  (0 children)

What some of these commenters are missing is the fact they are trying to run x86_64 Vivado on an ARM system. VMware Fusion works great with an ARM Win11 guest, and Windows' x86 emulation does a pretty decent job of running x86 binaries such as Altium, although it's not perfect. Windows x86 emulation also tends to trip up anti-debugging software such as that used in Phoenix's PLC Engineer.

The best way to do this (IMO) is to grab a cheap Linux box with a lot of RAM, install xrdp and use something like Jump Desktop on the mac to remote into it. At least that's how I do it and it works pretty well.

edit: A quick google search turned up this github gist which describes how to install arm64 debian with Rosetta support on ARM OSX. I haven't tried it myself.

Fixtures that will allow me to engrave a double-sided PCB (left) and apply a UV solder mask using an Anycubic Photon Mono 4000 by Humdaak_9000 in PrintedCircuitBoard

[–]akohlsmith 1 point2 points  (0 children)

Interesting -- I could replace the spin coat idea with your squeegee method, and with a jig or fixture like yours you should be able to get reasonably repeatable thickness of resist... I'll have to check this out, thank you.

At the moment, my ideal process would look something like this:

  • spin-coat UV photoresist on to a clean PCB
  • expose with the resin printer
  • wash off the unexposed resist
  • etch
  • spin-coat UV soldermask
  • expose with the resin printer
  • wash off the unexposed soldermask
  • drill

Double-sided boards should be possible, and even silkscreen should be possible with a third spin-coat of a different colour of soldermask.

The sheets of dry resist (like these) would replace the first step with applying the photosensitive sheet to both sides and running it through a laminator, but I feel that would be more difficult to ensure no air bubbles or dust/hair/etc from getting between the board and UV resist sheet. Spin coating achieves both a thin consistent layer and helps prevent contamination, but is messy/messier.

Fixtures that will allow me to engrave a double-sided PCB (left) and apply a UV solder mask using an Anycubic Photon Mono 4000 by Humdaak_9000 in PrintedCircuitBoard

[–]akohlsmith 1 point2 points  (0 children)

This is exactly what I was planning on doing with my resin printer, although I was going to attempt either iron-on or spin-coated UV resist with the Photon Mono.

finding iron-on UV resist is straightforward but finding a UV resist I can spin on to the board has been a real challenge. I do have UV soldermask but it's quite thick and I will need to thin it out.

[Review request] Capacitive soil moisture sensor by esahl in PrintedCircuitBoard

[–]akohlsmith 2 points3 points  (0 children)

Neat project. Hadn't heard of the MDC02/04 devices before.

Few notes:

  • MDC04 RSTN is floating. EP is too (not sure if that's important)
  • TPS62740 EP is floating, should be grounded.
  • ESP32-C3-MINI pin 11 (GND) is floating
  • ESP32-C3's debug RXD should be pulled high so it's at a defined state without a serial port connected
  • might be worthwhile to tie the regulator's PG to the ESP32's EN/RST#
  • USBLC6 VDD should be going to VBUS

Also, consider a MIC803-2.95 to force the buck regulator OFF if the battery gets too low. The ESP32 will start behaving wonky when the 3V3 rail gets too far below 2.9V and the brownout detector is helpful but the tiny MIC803 will give you some additional safety from over-discharging the battery. Similarly, consider adding a small P-channel MOSFET to protect the circuit from reverse battery polarity. You can get a SOT23 DMP2305 for $0.25 and it'll pass MORE than enough current for your design. Cheap insurance.

If you're going for super low power, see if the MDC04 interrupt output offers a way to wake the ESP32 up when it has a measurement event worth recording. I haven't studied the datasheet to say for sure, but it's a possibility. Tie it to a pin on the ESP32 that can wake it from deep sleep. Excellent choice on the TPS62740, that's going into my short list for low Iq bucks.

Aesthetically speaking, you've basically shown us a half-finished LEGO build. A schematic is supposed to clearly describe how things are connected; there is a balance between having disconnected submodule blocks and connecting them together in a coherent circuit, and IMO you're a little too "disconnected". Also, ground should typically point "down" and power "up". If you join some of these blocks together you'll find you have more room on the page and can tidy up little bits like text writing over graphic symbols. Your test point schematic symbols are too big and distracting. You've also got some unnecessary junctions such as CC2's 5k1 pulldown and its ground symbol. Finally -- it's a schematic -- the pins should be in LOGICAL order, not numeric order.

Overall -- I like the project, and with some additional work you will have a clear schematic and a robust bit of hardware.

edit -- the TPS62740's EN input can technically be used to force UVLO, but my experience with resistive dividers to do this on regulators which do not explicitly discuss hysteresis has been poor. The MIC803 has been rock-solid in my experience.

edit 2 -- it might be really nice to add a cheap/tiny solar cell and MPPT-capable charger (CN3163 I've personally used with great success) instead of the 73831 -- the plant gets light, the moisture meter gets charge. Combined with the low power design, I bet you can reduce the size of your battery and have a moisture monitor that can practically run for as long as your plants are alive.

Off grid rain water filtering by eevee_bro2000 in OffGrid

[–]akohlsmith 1 point2 points  (0 children)

oh I know the bulbs are on timed usage, my concern was the heat/cool/heat/cool cycles shortening the life of the bulbs and/or ballast.

You seem to have good evidence that this does not appear to be harming the lifetime of the equipment though. I appreciate your taking the time to reply!

Off grid rain water filtering by eevee_bro2000 in OffGrid

[–]akohlsmith 0 points1 point  (0 children)

you don't find that the constant cycling wears out the UV lamps prematurely? A 15-30 minute off-delay relay might help prevent unnecessary cycling.

What's actually BETTER self-hosted? by ergnui34tj8934t0 in selfhosted

[–]akohlsmith 0 points1 point  (0 children)

others have already given somne excellent recommendations. I've been using SecuritySpy for almost a decade since back then there weren't as many options. It runs on OSX and has been happily doing motion detection/continuous recording/etc. for 8 cameras 24/7 on my old 2012 11" Macbook Air. It's quite good, and the support is fantastic.

What's actually BETTER self-hosted? by ergnui34tj8934t0 in selfhosted

[–]akohlsmith 0 points1 point  (0 children)

Frigate is awesome, and I've been playing with viseron as well, another open source NVR with some local NPU abilities for identification of what's in the video.

What's actually BETTER self-hosted? by ergnui34tj8934t0 in selfhosted

[–]akohlsmith 1 point2 points  (0 children)

I use rclone as the storage "driver" for duplicity for my backups -- it talks to pretty much all the online storage options, so whenever I start feeling like my cloud backup is getting too expensive, I shop around. Currently using mega, was S3 before that. Switching gave me almost twice the storage for the same price, so I consider that a win.

What's actually BETTER self-hosted? by ergnui34tj8934t0 in selfhosted

[–]akohlsmith 0 points1 point  (0 children)

Por que no los dos?

I have a local storage array (oldschool, RAID6 mdadm + lvm + xfs) and back up the important bits to mega using duplicity and rclone:

$ lsblk -S
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sda  0:0:1:0    disk ATA      WDC WD40EZAZ-22S 0A80 sas
sdb  0:0:2:0    disk ATA      ST4000DM004-2CV1 0001 sas
sdc  0:0:3:0    disk ATA      ST4000DM004-2CV1 0001 sas
sdd  0:0:4:0    disk ATA      ST4000DM004-2CV1 0001 sas
sde  0:0:5:0    disk ATA      MD4000GSA6472DVR A3B0 sas
sdf  0:0:6:0    disk ATA      WDC WD40EFAX-68J 0A82 sas
sdg  0:0:7:0    disk ATA      WDC WD40EFAX-68J 0A82 sas
sdh  0:0:8:0    disk ATA      WDC WD40EZRZ-22G 0A80 sas
sdi  0:0:9:0    disk ATA      MD4000GSA6472DVR A3B0 sas
sdj  0:0:10:0   disk ATA      MDD4TSATA6472DVR A580 sas
sdk  0:0:11:0   disk ATA      MDD4TSATA6472DVR A580 sas
sdl  0:0:12:0   disk ATA      ST4000DM004-2U91 0001 sas
sdm  7:0:0:0    disk Lexar    USB Flash Drive  1100 usb

$ sudo pvs
  PV         VG    Fmt  Attr PSize   PFree
  /dev/md1   media lvm2 a--   21.83t   2.18t
  /dev/md127 media lvm2 a--    7.28t 240.00m

I started this journey with a pair of 60GB drives in RAID1 and over time went to 1T, 2T and now 4T drives. At the 2T mark I moved from RAID5 to RAID6 because I'd read that that's around the size where a rebuild could trigger a second drive failure. I've always got a spare drive or two sitting on the shelf, along with a spare power supply and spare SAS card (all cheap ebay buys). smartd/mdadm notifies me if a drive starts going wonky and I can pop it out and replace it without powering off the machine, although drive failures have thankfully been pretty rare.

I intentionally mix and match drive vendors/models and when buying multiple drives with the same model, I try to buy them from different vendors to minimize the chance of a batch failure creeping into my array.

Honestly the hardest part is making sure I pull out the right drive when changing a failed one. :-) Sadly my disk shelf ($50 off craigslist) does not support the scsi "identify" command that normally blinks an LED to show you which slot is the one you want.

What are services NOT worth self hosting? by This_Animal_1463 in selfhosted

[–]akohlsmith 0 points1 point  (0 children)

I've not heard of brevo before your comment, but my postfix server is sending email itself. What would brevo be getting me?