Tag Archives: DIY

Track Everything, Everywhere with an IoT Barcode Scanner

I’ve always considered barcodes to be one of those invisible innovations that profoundly changed the world. What we might recognize as modern barcodes were originally designed as a labor-saving device in the rail and retail industries, but were quickly adopted by factories for automation, hospitals to help prevent medication errors, and a wide variety of other industries to track the movements of goods.

Medication errors in hospitals are serious and scary: enter the humble barcode to save lives. Source: The State and Trends of Barcode, RFID, Biometric and Pharmacy Automation Technologies in US Hospitals

The technology is accessible, since all you really need is a printer to make barcodes. If you’re already printing packaging for a product, it only costs you ink, or perhaps a small sticker. Barcodes are so ubiquitous that we’ve ceased noticing them; as an experiment I took a moment to count all of them on my (cluttered) desk – I found 43 and probably didn’t find them all.

Despite that, I’ve only used them in exactly one project: a consultant and friend of mine asked me to build a reference database out of his fairly extensive library. I had a tablet with a camera in 2011, and used it to scan the ISBN barcodes to a list. That list was used to get the information needed to automatically enter the reference to a simple database, all I had to do was quickly verify that it was correct.

While this saved me a lot of time, I learned that using tablet or smartphone cameras to scan barcodes was actually very cumbersome when you have a lot of them to process. And so I looked into what it takes to hack together a robust barcode system without breaking the bank.

Source: IoTMaker.vn

A Barcode Reader to Make a Hacker Proud

Dedicated barcode scanners cost around $20 USD from banggood or DX and are an obvious solution, but that would be boring. I also wanted a more powerful device: a barcode scanner that could directly connect to the Internet so I could track things centrally online without any further hardware. While the idea was hardly unique, it still stuck with me. Recently, I saw a tiny barcode scanner module (Youku E1005) for sale for $17 USD with no datasheet, and I knew the game was on.

The scanner module itself was very compact, which lent itself well to making a convenient device. It had a generic unlabeled MCU, and a 12-pin ribbon cable connector. The vendor told me it supported Code 39 barcodes (true – but it actually supports many more!), and had USB and TTL output. It was time to puzzle the module out!

Dissecting Barcode Hardware

Not my finest soldering job.

Logically, some of the 12 pins were going to be power, ground, USB data lines, and TTL serial output. Typically these modules are used to build hand-held barcode scanners, so also require a trigger to be pressed to activate the scanner. The first step was to desolder the connector so I could get access to the pads underneath.

The next step was to identify power and ground. Ground was pretty easy since several components were connected to what was clearly a ground plane. The power pin was harder, but there was an IC that looked like a voltage regulator in a SOT-753 package. Given common pinouts, both the enable and the voltage input pins were connected to a single pad.

Having probable inputs for power and ground, I connected 3.3v to the circuit. Nothing happened, which is expected as I’ve yet to find the trigger pin that activates the device. The easiest thing to do was to quickly connect each remaining pad to ground and see if the trigger was of the ‘active-low’ variety. It turned out it was, and the LED of the device turned on to indicate it was ready to scan.

Making Sense of It All

Pin Function
2 VCC
3 GND
5 TX
12 Trigger

The final step was to find the TTL output. That turned out to be pretty easy now that I could force the device to scan barcodes. I took an arbitrary barcode and scanned it while looking at different pins on my oscilloscope. When I found output, I captured it so I could determine the baud rate later on. The final pinout I found is to the right. The flat cable connector pads were fairly dense, so I soldered wires to components connected to the relevant pads rather than the pads themselves where possible.

After scanning a barcode and capturing the output on my oscilloscope, I saw that the duration of the shortest peak was just over 100μs. That translates to a frequency of a little under 10000 bits per second. The closest common baudrate is 9600 baud, so that is likely our TTL baudrate. Now, we have all the information we need to connect the barcode scanner module to a microcontroller, in our case an ESP8266 running NodeMCU.

The first peak has the shortest duration in the sequence, at about 105μs. A reasonable baud rate to try is the closest common one to 1s/105μs = 9523 baud, which is 9600 baud.

Our code will be very simple: Change the UART speed to 9600 baud, and when any data is received concatenate what comes in for the next 150 milliseconds and print it out. Remember to set the baud rate of your development tool (e.g. ESPlorer) to 9600 as well.


-- Setup UART and print something so we know it's working

uart.setup(0, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1, 0)
print("Scanning")

-- Set up a couple of variables so they're not nil

data = ""
datac = ""

-- This function prints out the barcode data and clears all variables so the scanner can read a new barcode. If you wanted to send the data over MQTT, your code would replace the print statement here.

function finish()
    print(datac)
    data = ""
    datac = ""
end

-- This function concatenates all data received over 150 milliseconds into the variable datac. The scanner sends the data in multiple parts to the ESP8266, which needs to be assembled into a single variable.

uart.on("data", 0, function(data)
    tmr.alarm(0,150,0,finish)
    datac = datac .. data
end, 0)

This worked quite nicely and was able to read various types of barcode without issue. It would be very easy to connect this to a server on the Internet, either directly via MQTT, or using an Internet of Things dashboard. It would even be possible to implement encryption and authentication if you needed.

Custom Tricks Now Open Up To Us

An interesting fact is that the NodeMCU is capable of executing serial input, so make sure that feature is turned off (the 0 at the end of the uart.setup line). Otherwise someone will promptly drop by with the barcode to the right. The usual precautions apply to the backend as well. You could even filter out problematic characters at the hardware level, which would be nice. Of course if you’re clever this could be a feature and not a vulnerability.

I didn’t have a particular use case for this barcode scanner in mind, but it would be nice to see someone implement it in a cloud Point-of-Sale system for small merchants in Asia to track inventory in a primarily cash-based economy. In effect that would be very similar to the original use of barcode scanners – minus the expensive POS system.

Finally, while at a local convenience store, I saw the perfect project case for this sitting on a shelf. I bought it, and it was filled with candy! Sometimes we live in the best of all possible worlds:

Fun fact: all my hacks are sugarfree and do not cause tooth decay. The case also comes in an extra cool variety, but I’m saving that for another day.

from Blog – Hackaday https://ift.tt/2w8IUGe
via IFTTT

Track Everything, Everywhere with an IoT Barcode Scanner

I’ve always considered barcodes to be one of those invisible innovations that profoundly changed the world. What we might recognize as modern barcodes were originally designed as a labor-saving device in the rail and retail industries, but were quickly adopted by factories for automation, hospitals to help prevent medication errors, and a wide variety of other industries to track the movements of goods.

Medication errors in hospitals are serious and scary: enter the humble barcode to save lives. Source: The State and Trends of Barcode, RFID, Biometric and Pharmacy Automation Technologies in US Hospitals

The technology is accessible, since all you really need is a printer to make barcodes. If you’re already printing packaging for a product, it only costs you ink, or perhaps a small sticker. Barcodes are so ubiquitous that we’ve ceased noticing them; as an experiment I took a moment to count all of them on my (cluttered) desk – I found 43 and probably didn’t find them all.

Despite that, I’ve only used them in exactly one project: a consultant and friend of mine asked me to build a reference database out of his fairly extensive library. I had a tablet with a camera in 2011, and used it to scan the ISBN barcodes to a list. That list was used to get the information needed to automatically enter the reference to a simple database, all I had to do was quickly verify that it was correct.

While this saved me a lot of time, I learned that using tablet or smartphone cameras to scan barcodes was actually very cumbersome when you have a lot of them to process. And so I looked into what it takes to hack together a robust barcode system without breaking the bank.

Source: IoTMaker.vn

A Barcode Reader to Make a Hacker Proud

Dedicated barcode scanners cost around $20 USD from banggood or DX and are an obvious solution, but that would be boring. I also wanted a more powerful device: a barcode scanner that could directly connect to the Internet so I could track things centrally online without any further hardware. While the idea was hardly unique, it still stuck with me. Recently, I saw a tiny barcode scanner module (Youku E1005) for sale for $17 USD with no datasheet, and I knew the game was on.

The scanner module itself was very compact, which lent itself well to making a convenient device. It had a generic unlabeled MCU, and a 12-pin ribbon cable connector. The vendor told me it supported Code 39 barcodes (true – but it actually supports many more!), and had USB and TTL output. It was time to puzzle the module out!

Dissecting Barcode Hardware

Not my finest soldering job.

Logically, some of the 12 pins were going to be power, ground, USB data lines, and TTL serial output. Typically these modules are used to build hand-held barcode scanners, so also require a trigger to be pressed to activate the scanner. The first step was to desolder the connector so I could get access to the pads underneath.

The next step was to identify power and ground. Ground was pretty easy since several components were connected to what was clearly a ground plane. The power pin was harder, but there was an IC that looked like a voltage regulator in a SOT-753 package. Given common pinouts, both the enable and the voltage input pins were connected to a single pad.

Having probable inputs for power and ground, I connected 3.3v to the circuit. Nothing happened, which is expected as I’ve yet to find the trigger pin that activates the device. The easiest thing to do was to quickly connect each remaining pad to ground and see if the trigger was of the ‘active-low’ variety. It turned out it was, and the LED of the device turned on to indicate it was ready to scan.

Making Sense of It All

Pin Function
2 VCC
3 GND
5 TX
12 Trigger

The final step was to find the TTL output. That turned out to be pretty easy now that I could force the device to scan barcodes. I took an arbitrary barcode and scanned it while looking at different pins on my oscilloscope. When I found output, I captured it so I could determine the baud rate later on. The final pinout I found is to the right. The flat cable connector pads were fairly dense, so I soldered wires to components connected to the relevant pads rather than the pads themselves where possible.

After scanning a barcode and capturing the output on my oscilloscope, I saw that the duration of the shortest peak was just over 100μs. That translates to a frequency of a little under 10000 bits per second. The closest common baudrate is 9600 baud, so that is likely our TTL baudrate. Now, we have all the information we need to connect the barcode scanner module to a microcontroller, in our case an ESP8266 running NodeMCU.

The first peak has the shortest duration in the sequence, at about 105μs. A reasonable baud rate to try is the closest common one to 1s/105μs = 9523 baud, which is 9600 baud.

Our code will be very simple: Change the UART speed to 9600 baud, and when any data is received concatenate what comes in for the next 150 milliseconds and print it out. Remember to set the baud rate of your development tool (e.g. ESPlorer) to 9600 as well.


-- Setup UART and print something so we know it's working

uart.setup(0, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1, 0)
print("Scanning")

-- Set up a couple of variables so they're not nil

data = ""
datac = ""

-- This function prints out the barcode data and clears all variables so the scanner can read a new barcode. If you wanted to send the data over MQTT, your code would replace the print statement here.

function finish()
    print(datac)
    data = ""
    datac = ""
end

-- This function concatenates all data received over 150 milliseconds into the variable datac. The scanner sends the data in multiple parts to the ESP8266, which needs to be assembled into a single variable.

uart.on("data", 0, function(data)
    tmr.alarm(0,150,0,finish)
    datac = datac .. data
end, 0)

This worked quite nicely and was able to read various types of barcode without issue. It would be very easy to connect this to a server on the Internet, either directly via MQTT, or using an Internet of Things dashboard. It would even be possible to implement encryption and authentication if you needed.

Custom Tricks Now Open Up To Us

An interesting fact is that the NodeMCU is capable of executing serial input, so make sure that feature is turned off (the 0 at the end of the uart.setup line). Otherwise someone will promptly drop by with the barcode to the right. The usual precautions apply to the backend as well. You could even filter out problematic characters at the hardware level, which would be nice. Of course if you’re clever this could be a feature and not a vulnerability.

I didn’t have a particular use case for this barcode scanner in mind, but it would be nice to see someone implement it in a cloud Point-of-Sale system for small merchants in Asia to track inventory in a primarily cash-based economy. In effect that would be very similar to the original use of barcode scanners – minus the expensive POS system.

Finally, while at a local convenience store, I saw the perfect project case for this sitting on a shelf. I bought it, and it was filled with candy! Sometimes we live in the best of all possible worlds:

Fun fact: all my hacks are sugarfree and do not cause tooth decay. The case also comes in an extra cool variety, but I’m saving that for another day.

from Blog – Hackaday https://ift.tt/2w8IUGe
via IFTTT

Friday Hack Chat: LED Diffusion

A decade ago, the first Arduino projects featuring addressable RGB LEDs came on the scene, and the world hasn’t been the same since. Now we have full wall video displays with WS2812s and APA102s, wearable blinky, and entire suits of armor made of LEDs. The future is bright, and in RGB.

For this week’s Hack Chat, we’re going to be talking all about how to maintain the blinky without eye-searing brightness. It’s the LED Diffusion Hack Chat, full of tips and tricks on how to get the glowey without it being imprinted on your retina.

Our guest for this week’s Hack Chat is the incredible Becky Stern. Becky is one of the most prolific makers around and has a long history of fabricating some really, really cool stuff. She’s published hundreds of tutorials on everything from microcontrollers to computerized knitting machines, and has been featured by dozens of media outlets including the BBC, CNN, The Late Show with Colbert, VICE, and Forbes. Right now, she’s working at Autodesk with Instructables.

During this Hack Chat, we’re going to be talking all about diffusing LEDs, with topics including:

  • Taking some sandpaper to LEDs
  • Light pipes
  • 3D printed LED enclosures
  • Looking into a bright blue LED with your remaining eye

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Hack Chat Event Page and we’ll put that in the queue for the Hack Chat discussion.join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This week is just like any other, and we’ll be gathering ’round our video terminals at noon, Pacific, on Friday, August 17th. Need a countdown timer? Here ‘ya go.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

from Blog – Hackaday https://ift.tt/2Pd2M3W
via IFTTT

Friday Hack Chat: LED Diffusion

A decade ago, the first Arduino projects featuring addressable RGB LEDs came on the scene, and the world hasn’t been the same since. Now we have full wall video displays with WS2812s and APA102s, wearable blinky, and entire suits of armor made of LEDs. The future is bright, and in RGB.

For this week’s Hack Chat, we’re going to be talking all about how to maintain the blinky without eye-searing brightness. It’s the LED Diffusion Hack Chat, full of tips and tricks on how to get the glowey without it being imprinted on your retina.

Our guest for this week’s Hack Chat is the incredible Becky Stern. Becky is one of the most prolific makers around and has a long history of fabricating some really, really cool stuff. She’s published hundreds of tutorials on everything from microcontrollers to computerized knitting machines, and has been featured by dozens of media outlets including the BBC, CNN, The Late Show with Colbert, VICE, and Forbes. Right now, she’s working at Autodesk with Instructables.

During this Hack Chat, we’re going to be talking all about diffusing LEDs, with topics including:

  • Taking some sandpaper to LEDs
  • Light pipes
  • 3D printed LED enclosures
  • Looking into a bright blue LED with your remaining eye

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Hack Chat Event Page and we’ll put that in the queue for the Hack Chat discussion.join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This week is just like any other, and we’ll be gathering ’round our video terminals at noon, Pacific, on Friday, August 17th. Need a countdown timer? Here ‘ya go.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

from Blog – Hackaday https://ift.tt/2Pd2M3W
via IFTTT

Friday Hack Chat: LED Diffusion

A decade ago, the first Arduino projects featuring addressable RGB LEDs came on the scene, and the world hasn’t been the same since. Now we have full wall video displays with WS2812s and APA102s, wearable blinky, and entire suits of armor made of LEDs. The future is bright, and in RGB.

For this week’s Hack Chat, we’re going to be talking all about how to maintain the blinky without eye-searing brightness. It’s the LED Diffusion Hack Chat, full of tips and tricks on how to get the glowey without it being imprinted on your retina.

Our guest for this week’s Hack Chat is the incredible Becky Stern. Becky is one of the most prolific makers around and has a long history of fabricating some really, really cool stuff. She’s published hundreds of tutorials on everything from microcontrollers to computerized knitting machines, and has been featured by dozens of media outlets including the BBC, CNN, The Late Show with Colbert, VICE, and Forbes. Right now, she’s working at Autodesk with Instructables.

During this Hack Chat, we’re going to be talking all about diffusing LEDs, with topics including:

  • Taking some sandpaper to LEDs
  • Light pipes
  • 3D printed LED enclosures
  • Looking into a bright blue LED with your remaining eye

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Hack Chat Event Page and we’ll put that in the queue for the Hack Chat discussion.join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This week is just like any other, and we’ll be gathering ’round our video terminals at noon, Pacific, on Friday, August 17th. Need a countdown timer? Here ‘ya go.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

from Blog – Hackaday https://ift.tt/2Pd2M3W
via IFTTT

Friday Hack Chat: LED Diffusion

A decade ago, the first Arduino projects featuring addressable RGB LEDs came on the scene, and the world hasn’t been the same since. Now we have full wall video displays with WS2812s and APA102s, wearable blinky, and entire suits of armor made of LEDs. The future is bright, and in RGB.

For this week’s Hack Chat, we’re going to be talking all about how to maintain the blinky without eye-searing brightness. It’s the LED Diffusion Hack Chat, full of tips and tricks on how to get the glowey without it being imprinted on your retina.

Our guest for this week’s Hack Chat is the incredible Becky Stern. Becky is one of the most prolific makers around and has a long history of fabricating some really, really cool stuff. She’s published hundreds of tutorials on everything from microcontrollers to computerized knitting machines, and has been featured by dozens of media outlets including the BBC, CNN, The Late Show with Colbert, VICE, and Forbes. Right now, she’s working at Autodesk with Instructables.

During this Hack Chat, we’re going to be talking all about diffusing LEDs, with topics including:

  • Taking some sandpaper to LEDs
  • Light pipes
  • 3D printed LED enclosures
  • Looking into a bright blue LED with your remaining eye

You are, of course, encouraged to add your own questions to the discussion. You can do that by leaving a comment on the Hack Chat Event Page and we’ll put that in the queue for the Hack Chat discussion.join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This week is just like any other, and we’ll be gathering ’round our video terminals at noon, Pacific, on Friday, August 17th. Need a countdown timer? Here ‘ya go.

Click that speech bubble to the right, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.

from Blog – Hackaday https://ift.tt/2Pd2M3W
via IFTTT

Arcade Inspired Halloween Candy Dispenser

The days are getting shorter and the nights are a little cooler, which can only mean one thing: it’s officially time to start devising the trials you’ll put the neighborhood children through this Halloween. For [Randall Hendricks], that means building a new candy dispensing machine to make sure the kids have to work for their sugary reward. After all, where’s the challenge in just walking up and taking some candy from a bowl? These kids need to build character.

[Randall] writes in to share his early work on this year’s candy contraption which he’s based on a popular arcade game called “Goal Line Rush”. In this skill based game a disc with various prizes spins slowly inside the machine, and the player has a button that will extend an arm from the rear of the disc. The trick is getting the timing right to push the prize off the disc and into the chute. Replace the prizes with some empty calorie balls of high fructose corn syrup, and you get the idea.

There’s still plenty of time before All Hallows’ Eve, so the machine is understandably still a bit rough. He hasn’t started the enclosure yet, and at this point is still finalizing the mechanics. But this early peek looks very promising, and in the video after the break you can see how the machine doles out the goodies.

The disc is rotated by a high torque motor, and the aluminum extrusion arm is actuated with a gear motor and custom chain drive. Some 3D printed hardware, a couple limit switches, and a pair of relays make for a fairly straightforward way of pushing the rod out when the player presses the button on the front of the cabinet.

Considering how his previous Mario-themed candy dispenser came out, we doubt this new machine will fail to impress come October. The neighborhood kids should just count themselves lucky he’s not using his creativity to terrorize them instead.

from Blog – Hackaday https://ift.tt/2nHZARk
via IFTTT