Show HN: Giving a Broken Barcode Scanner a New Life with Elixir and Nerves
bcarrigan.com
bcarrigan.com
I'm surprised by how simple and easy to understand the data serialisation is on some bits of hardware as in this case.
For general tinkering and exploring I picked up the Digilent Analog Explorer 2 with the Ham Radio bundle[1]. They had a coupon deal where 'hamradioworkbench2018' would unlock a $100 discount. Not sure if that still works. While it is a USB scope (so you are dependent on your PC/Laptop for a display) it includes some other useful bench top tools.
Used scopes in the 100 - 200 Mhz range from the 90's are often pretty inexpensive and can usually be calibrated and repaired. This is especially true of the Tektronix 465 and 475 series which were sold in huge numbers. While not as crisp as a digital scope they work well and can be found (at least in the Bay Area) for $50 - $100. About double that on ebay.
The Rigol folks really pushed the price point hard and their DS1054 and DS1102D series are fairly common and inexpensive at $300 - $500.
Scrounge around HAMFests or surplus liquidators and you can often find a deal if you know what you want.
[1] https://store.digilentinc.com/ham-radio-workbench-bundle/
Of course, you can always just see about taking matters into your own hands (http://gotroot.ca/rigol/riglol/)
Unless you do a lot of high speed IO, 25MHz covers pretty much everything (most 8-bit Micros top out at 20MHz, some go to 48-50MHz). Even the 10MHz version is fine if you were just doing audio work or slower digital stuff.
For £300 you could get a 50MHz 2 channel scope (at 0.5Gs/s). If you want 4 channels you're not going to beat the Rigol for price, but portability matters sometimes (other times being able to monitor every SPI line simultaneously is a godsend). I have a Rigol DS1104Z and a Picoscope 2205A, I've used both extensively.
Plus you get a lot of nice features in the software (which is cross platform), including serial decoding for free. Most of them have a signal generator built in too.
This pairing would make for a trully tiny all in one oscilliscope, i'm tempted to get a picoscope and a tiny LCD just for laughs: project #1
I don't even know what the frequency limitations of USB are I just know it's capabilities are highly dependent on the host so relying on it for precise high frequency sampling seems like a bad idea, and if that is the case for the picoscope then you are correct, I just find it a surprising design decision.
Am I wrong in thinking this? or are you referring to a different reason?
This is something that you need to grok when using scopes: you're capturing (often) a teeny-tiny snapshot of time. The waveform on your display might be 50ns wide. You certainly can't process this data in real-time using your eyes (that'd be 20 million frames a second). So you're not seeing a continuous signal, you're seeing short snippets of your signal separated by some dead time. The majority of this dead time is probably just writing to the display. You're not pushing pixels to the display at the sampling rate of the scope, otherwise these would be some of the best monitors in existence!
Usually scopes are triggered somehow and you'll be sent waveforms, typically centred on the trigger point, at some maximum frame rate. So you'll see a little bit before the trigger and a little bit after. Most scopes let you vary the trigger offset, e.g. if care more about stuff that happens before or after. Using an oscilloscope well is all about the triggering!
The scope will have (a) a max. sampling speed and (b) a fixed size sample buffer. You trade off both. You can sample really fast for a short period of time, or slower, but see a longer time period. If you want to see 'all' the signal, then you can set the timebase to something long - e.g. 100ms/div. That's useful for seeing slowly varying signals, but you'll lose resolution. A scope with a nice big sample buffer will let you zoom in on a signal once its been captured.
Once the buffer is full, the scope has to transfer that data to you, either directly to a screen or over a serial connection. Unless you're in single shot mode, this process will repeat every time the trigger condition is satisfied.
I was kinda hoping that this would be someone porting Nerves to run on the barcode scanner itself; quite a few of these scanners actually have reasonably-powerful ARM cores (especially once you get into the 2D scanners).
For RS232 any 'scope is going to be fine, even a chinese clone knockoff or an ancient second hand scope.
https://www.aliexpress.com/item/New-Arrival-USB-Logic-Analyz...
If you're a beginner I would actually recommend the Saleae Logic Analyser over this scope, unless your routinely dealing with analog or voltages over 5.5V, the Saleae is much more useful, has serial (and other) decoders built in as opposed to having to pay extra on the Rigol, has better capture and triggers plus as a bonus it doesnt have that noisy fan going all the time.
I use my scope just often enough that I'm glad I have it, but I sometimes also regret buying it because it's not that often that I actually need it.
Also worth noting that Sigrok loads the analyzer with open source firmware, you're not using any pirated code. The hardware is basically a clone of the original Saleae logic analyzer, but the Saleae hardware is just a standard reference implementation of a cheap Cypress chip so that doesn't really bother me.
The only differentiation I can see is the really expensive ones can scan the tiny 2d codes that are silkscreened on some ICs, and the cheap ones are limited to about the same resolution that a standard consumer printer can print a barcode at. Unless you have some very specialized requirements, you should be good with just about any cheap barcode scanner.
An important thing for secondhand ones is to download the manual; it will contain a set of configuration barcodes so you can factory reset it, turn off beeping, etc.
It's nice to see that someone else came up with this idea, executed it so well.
I was thinking of something similar, but mostly as an inventory + expiration tracking system, because we often forget what we have in the fridge and cabinets. I love the integration with Wunderlist for adding to the shopping list as well!
Great writeup with detail!
I'd like to do a database of products purchase, purchase date, price paid, scan a barcode and mark it as consumed, and calculate typical consumption rate of the products.
I will keep things pretty simple, either a sqlite database that stays local or a LAMP setup so I've got access to an inventory list at the store along with "price check" functionality.