From Hacking to Engineering: Arduino Powered Packaging Machine

March 03, 2022

from-hacking-to-engineering--arduino-powered-packaging-machine  Facebook  Twitter  Google +  

 Well, it's happened. Mayans was right about doomsday, just miscalculated 8 years earlier. We experienced an immersive sci-fi movie scene. Everyone stuck at home and cook bread. Also i stuck at workshop for weeks and tried to resurrect 20 years old non functional analog packaging machine by wiring and coding. After two years i had a chance to document the project hence everything become normal again.

 The Concept
 To whose isn't familiar with this kind of machines, let me give a quick brief: There is a three phase 380v AC motor with 1/60 reduction starts to rotate when electrified and mechanical switches on crank mill arranges the timing of other motors like product filling and paper feeding. No electronics.

 I did the entire wiring from scratch and developed a quick sketch in arduino to entirely take over the timing control in four phases:
 1: Mill run to open blades
 2: Mill Stop, Feed paper
 3: Paper Stop, Start filling
 4: Stop filling, Mill run to cut paper
 Technical Challenges

 - Sensor voltages: This kind of machines completely driven by 220v AC sensors, first i have to reduce them to trigger 5v, so i installed mini 220v relays to sensor inputs and send ground signal to arduino by using it's internal pull-up resistors.

 - EMI Interference: I had to remove AC contactors and replace them by 220v SSR relays, they're misfiring on idle but that's acceptable. 

 - Torque & Power changes: Currently engines are driven by time, but time is also not constant. Engine should turn in exact same rpm on every cycle but it's not, so i have to implement arduino compatible 5v ttl sensors and do the all operation based on sensor inputs instead blind timing.

 - Application Crash: When you start to use dynamic arrays in C language you quit your small safe pond and dive into hardcore oceans of microcontroller. In those oceans also you should deploy more protection and failure scenerios. Let's say you're changing the paper, machine suddenly start itself and cut your finger or process froze exactly on blades closed and starts a fire. I'm considering a secondary eeprom module to pick up application state and sensor values in case of crash or reset. not implemented yet.
 Source Code
 I uploaded the first two project attempts into github, now working in third version to keep it more stable. you can find the repository in here.


Getting more from a digital bathroom scale

January 21, 2019

getting-more-from-a-digital-bathroom-scale  Facebook  Twitter  Google +  

 This idea was in my mind since decades but just don't want to waste a whole arduino for a single i/o operation which draw less than 2watts.

 Recently discovered digispark which is an ATtiny85 powered development board costs around $5. It's smaller than arduino pro mini which makes it perfect fit for wearables and iot projects.
 There is already wifi/bluetooth enabled bathroom scales available on the market but they're expensive and only sending data to their own application with a custom protocol. My setup costs around $10 and took one hour to deploy. It's collecting sensor values from hx711 load cell amplifier and transferring this information to pc with 443mhz wireless link. I attached a wireless receiver to previously mentioned sensor station which collecting the data and pushing it to my virtual assistant software called "Judith"

 How is the data processed
 I created a script that groups the same values in array and deciding the gross value by getting value of largest group. Previously i tried to take average of incoming data but this method provides more accurate readings.
 Virtual assistant writing that value to database and providing voice feedback after that. Also created a JSON api endpoint for chart visualization purposes.

 Assistant software is mostly turkish, planning to release it to public after a translation and some makeup but you can take a look to arduino sketch if interested with creating a similar setup.
 Shopping list
 + Bathroom scale - $8
 + hx711 load cell amplifier - $2
 + digispark dev board - $3
 + 443 mhz transmitter - $1

 arduino compatible source code available in here:


Path to #FAIL: Aqua Regia

December 08, 2018

path-to--fail--aqua-regia  Facebook  Twitter  Google +  

 That's a follow-up to previous entry. I collected unused simcards, expired credit cards, spare smartphone parts and melt them too into previously created hydrochloric acid+hydrogen peroxide solution.


 After the third day, i got avg 4 grams of gold dust and asked some jewelry workshops to if they're interested. Common question was "how pure is your gold?" I did a quick research about that, noticed even market standard alloys are contains only 95% of gold. Determination of purity is simple, just drop it into nitric acid and observe if it's turning into green or not. if it's not, it's safe to buy.
 Well, i literally fucked up this time. wasted one week, around $50 to chemicals and whole box of electronics. that's how: i was preparing to melt the dust. But put them to nitric acid to clean up the other particles and see how pure is it. What i wasn't know is the leftover hydrochloric acid (which dust was still wet) interacts with nitric acid and creates the only solution that can dissolve the gold called Aqua regia

 Being away just for 5 minutes, returned back, wtf! gold was completely dissolved as a yellowish fluid, just the other particles was left.

 I should wash the speckles twice before dip them into nitric acid. Learned via hard way.


Modern Alchemy: Salvaging gold from electronics

November 25, 2018

modern-alchemy--salvaging-gold-from-electronics  Facebook  Twitter  Google +  

 I was onto that subject since last couple years but didn't have enough time and parts to try it. As mentioned in previous entry, i'm keeping my e-waste since my childhood and send them to trash at earlier months. Except precious computer parts including cpu, ram, gfx card etc.

 You can repurpose an 20 year old power supply from an i386 ibm pc but even a 5 year old cpu is have no use today. Only thing you can do is extract it's gold plated base connectors.
 Well, impossible to convert one element to another as title describes but it's possible salvage hidden elements laying around here. I followed that instructions to initiate process but my experience was different a little due to time and economical limitations.
 Probably you have all the required components at the home right now, all you need is hydrogen peroxide and hydrochloric acid That mixture melting the Nickel which used as glue/base plate of gold in electronics. It's easy to find hydrochloric acid but h.peroxide is a little bit challenging. I visited a mall that sells industrial cleaning solutions and readed their labels one by one. Finally found hydrogen peroxide in a fabric stain remover.
 Trimmed the unnecessary parts and throwed to 50/50 solution and leaved it overnight. The next morning i noticed the gold dust at bottom of solution. That was a success but i did a mistake by using wool sheet as filter. All those gold specks are attached to wool which removing them was more challenging than extracting them from electronics.
 I washed wool sheet multiple times and cut out the clean parts, after couple hours all gold was flying around in pure water. Pulled the water by using a syringe and there it is, an exact 2gr of gold which worth 400tl/75usd today.
 Ofcourse it's hard to cash it out but i will try after melted them. It can be used as electroplating material in worst case. 

 Shopping List
 + Hydrogen Peroxide
 + Hydrochloric Acid
 + Syringe
 + Two glass bottles
 + Do not stir, that dissolves gold into more tiny particles even makes harder to filter it out.
 + Do not use a filter, just let them drop onto bottom of solution and pull solution by syringe.
 + Use a gas mask or do it at outdoors.
 that was the first attempt, i'll post the results after the second round.


New gadget: Wireless speaker

March 25, 2017

new-gadget--wireless-speaker  Facebook  Twitter  Google +  

 When amazon echo first released at 2014, i impressed with it's shape and unique reflex port design at first sight. The other features such as voice recognition & cloud services looks like chef's special sauce of the meal. useless, tastes bad but increases the price anyway.

 The motivation to develop an alexa replica started with release of the orange pi zero at november 2016, it's in a matchbox dimensions, powerful enough to process 4k video and ridiculously cheap ($10 was on first release, even $7 today)

 I purchased the board, installed armbian and conducted few tests with shairport and got acceptable results. Sound quality is exactly what i hear at pc, got 5-10 ms delay however it's still faster than speed of sound when considered we're going to use this thing at 20 meters away. By the way shairport is reverse engineered port of apple's airplay protocol to stream audio between iphone and mac. original git repository seems dead but it's fork shairport-sync still active today.
 Case design
 I was considering a shiny chrome pipe at same dimensions of amazon echo then decided to go with aluminium in case if i need to cut & drill with household tools. Processing the metal is whole another story, an instructable and a video available if interested.

 Audio Output
 Used 3W PAM8403 module as audio amplifier, luckily found two speakers on my scrap box with in exact power. Glued the woofer into a sink pipe to the imitate alexa's sound system and attached tweeter to bottom. There is a lot of teardown videos on the web, This article most clear one that described how original product works.
 Apple's devices still supporting airplay today, I'm using tuneblade for windows and using Allconnect for the android. Also another app called AirReceiverLite allows to stream from pc to android.

 + First problem was the power supply, i had to use two separate 5v-2a cellphone charger for audio amplifier and orange pi. eliminated the emf based resets and audio noise problem by dedicated power sources.

 + Wifi connectivity was another issue, orange pi's embedded chip XR819 nothing but a placebo. Easily affected by interference and got high latency. I used my pc's wifi dongle TL-WN727 which is dramatically changed the visual look. Armbian has limited support on third party devices, you have to find driver's source code and compile from scratch.

 Currently attached a microphone array for a possible voice recognition feature, but that's shifts things to a fulltime job from a hobby. A pir and adc module on the shipment for the playing audio only when someone exists on room, takes couple minutes to implement when it's arrived.

 Cost Table
 + Orange pi zero: $10
 + 5mm aluminum pipe: $8
 + PAM8403 amplifier: $3
 + 2x 5v2a cellphone charger: $5
 Wifi dongle and speakers was household items but let's give $10 to them, so total cost to me $36 plus 5~8 business days to work on.
Alternatively, working on a freelance job about two weeks and purchasing an airplay compatible speaker also an option.

 watch at youtube if having problems with video


Preventing cursor tremors via software

November 06, 2016

preventing-cursor-tremors-via-software  Facebook  Twitter  Google +  

 Speaking as the 80's generation, we're getting old. more than two cups of coffee causes hand tremors on our semi-deprecated body and that's makes you useless if you're coding for live. Found few solutions to fix that issue and they're definitely deserves a blog entry.

 Before the touch screen and optical pointers, each computer was controlling by Mechanical mice which is driven by a giant ball at the bottom and connected to serial or PS/2 port. You have to clean them at every month but they were completely stable. I used these things until 2006, then switched to optical mouse and torture has began.

 You don't have to do a periodic maintenance on optical mouse but they're only works on super clean surfaces with no reflectance. Even must be darker as possible. I was using my black shirt as mousepad while using them.

 Few years ago switched to three-monitor setup and purchased A4Tech XL-750BH laser mouse due to necessity of high resolution. Everything was okay on win7 and mouse cursor get sensitive again after upgraded to win8.1
 Somehow survived to today by messing with a shaking cursor and finally dedicated my last three days to fix it. My first idea was implementation of a kernel driver with kalman filter which is widely using in smartphones and quadcopters. Then found few similar solutions after a quick web search.

 SteadyMouse (Win32)
 It's almost 10 year old software, specifically designed for elderly users. tried it before but wasn't effective as i assumed. Does the job but you have to forfeit from mouse acceleration feature of operating system. First version is still freeware, 2016 release is more promising and it's asking for $97 for an updated version. download from here
 Povohat's mouse driver (Win32)
 This guy probably a gamer, there is a lot of reference in gaming forums and reddit. He's developed him own usb filter driver for FPS games and it's also works system wide. There is no actual repositioning filter implemented but it allows to customize in-depth sensitivity and acceleration settings. Works like a charm since one week.

 Old site:
 Smooth Cursor (Mac)
 Seems provides same functionality with povohat's driver, designed for mac users. 

 Tips for higher mouse performance
 + Use an usb hub with external power supply for a seamless mouse movement
 + Find a mousepad which made from fabric material.
 + Purchase a laser mouse if you can afford them, it worths to the investment.
 + Tie the extra mouse cable and shield this portion with aluminium foil. That's prevents the movement interruptions on EMI spikes.

Older Entries