Taobao breakout boards are a mess part 2

HMC5883L

Last week we struggled with mislabeled and faulty breakout boards from Taobao. Fortunately purchases from Shenzhen sellers usually arrive the next day, so we’ve already got a bunch of replacement boards to test.

HMC5883L/QMC5883 digital compass

Last week our HMC5883L breakout turned out to have a non-compatible QMC5883 chip. We need the genuine part to do a demo so we purchased four more from different suppliers. Each supplier confirmed that the breakout has an original HMC5883L, not the guochan (locally produced) QMC5883.

Of the four boards, only one has a genuine HMC5883L. The only seller with the original part actually offered the option of a guochan version for around 10RMB, or the original for around 40RMB. All the other breakouts came with a QMC5883 and cost around 10-15RMB. There are dozens of listings for this breakout on Taobao for around 10RMB, it’s safe to assume they’re all actually using a QMC5883.

circle

One of the sellers of the QMC5883 boards strenuously argued that the part was real and drew a helpful circle on our photo pointing out the model number. We countered with a photo of the chip markings compared to an original. At this point someone higher in the support chain, probably the boss, confirmed that “everyone” switched to the cheaper Chinese chip a year ago, and that buyers all know this. Now we know too.

SHT21 temperature and pressure sensor

SHT21

First, a correction from last week. We made a pretty basic mistake reading the SHT21 datasheet. The measurement resolution control of the configuration register is split into bits 7 and 0, not 7 and 6. After recognizing this the default value 0x3A is realistic.

Read correctly, bit 6 (0) correctly shows VDD > 2.25volts, the heater is disabled (bit 2=0), and OTP Reload is disabled (bit 1=1). Embarrassing, but an encouraging sign things are looking up.

SHT21

That leaves the issue of the impossibly high and definitely incorrect humidity measurement. We purchased a replacement SHT21 from Youxin, the original vendor, and samples from two other Taobao sellers.

All three breakouts work as expected, but on closer examination the board on the far right is actually an HTU21, not a Sensirion SHT21. HTU21 is a drop in replacement for the SHT21, but much cheaper. An Sensirion original is around 30RMB ($5), while the HTU21 is just 10RMB (~$1.50). The seller marked it as an SHT21 original and charged the market rate for an original (~35RMB). An extraordinarily low price consistently means non-original parts, but unfortunately a reasonable market price isn’t a reliable indicator of genuine parts.

It’s probably not a scam

The confusion probably starts with first line support reps that don’t know what they’re selling. If it says HMC5883, it must be HMC5883, right? Another part is being an informed consumer. If the original goes for 40RMB, the 12RMB version is going to be a substitute. This is obvious now, but the sheer volume of mislabeled listings makes it really hard to get a handle on a reasonable market price.

Taobao offers a huge selection of inexpensive parts, and next day delivery is usually around $1. That’s really amazing! However, getting multiples of everything to ensure at least one is genuine probably costs more than buying from a western-facing supplier like Seeed Studio, SparkFun or Adafruit.

Breakout boards from Taobao are a mess

cover

For the last few days I’ve been playing with breakout boards purchased from Taobao. So far it’s been a nightmare.

GY-271 is advertised as a Honeywell HMC5883L 3 axis digital compass. A Bus Pirate address search turned up 0x1A and 0x1B, instead of the HMC5883L’s 0x3C and 0x3D. The chip is actually a “Q”MC5883L, a Chinese-made digital compass with similar features that is not register compatible.

The datasheet for the QMC5883L shows the chip markings as “DA5833”. These markings are visible in nearly every Taobao listing claiming to be a HMC5883L breakout boards. Honeywell’s datasheet doesn’t include chip markings, shame on them.

GY-273 is another HMC5883L breakout board all over Taobao. About half of these are clearly the “Q” type chip. The other half show the Honeywell chip, at least in the photo. After talking with a quasi-trusted vendor I ordered what are supposed to be actual HMC5883L breakouts.

GY-213 is a breakout board sold with a variety of temperature and humidity sensors, including SI701, SHT21, etc. The same color/size/pinout/layout PCB is available from tons of Taobao shops. I ordered a SHT21 version from Youxin, a trusted supplier. The chip appears to be genuine, not the Chinese-made HTU21D, but it seems to be defective in at least two ways.

SHT21

Reading out the configuration register shows 0x3A=00111010, but the power up default should be 000xxx01. At power up the on-chip heater is enabled, which is used for testing and diagnosis. “OTP Reload” is enabled, which is specifically “not recommended for use” by the datasheet.

After setting the correct configuration it was time for further disappointment. Humidity measurement is always around 0xF66A. 114.3% humidity seems unrealistic, even for Shenzhen in the spring.

Dirty terminal sample pack

header

Crimp Terminals for Cables

Crimp terminals lock to the end of a wire and attach to an electrical connection such as a screw or terminal block. There are tons of different styles out there, but we found a handful that every Chinese cable manufacturer stocks. This is important because while reels of crimps are cheap, each crimp uses different tooling and manufacturers only buy tooling for the most common crimps.

In the previous post we covered commonly used JST and Molex compatible parts from the Shenzhen markets. These connectors come in two parts: a metal crimp that attaches to the wire, and a plastic crimp housing that holds all the crimps in place. This post looks at common crimp terminals that don’t use a plastic housing. Get the sample kit here, or build your own custom cables here.

Ring terminals

ring-set

These super common crimps attach to a bolt or screw terminal block. Four sizes are super common in the market and all fit a corresponding metric bolt size: 3.2mm (M3 bolt), 4.2mm (M4), 5.2mm (M5), 6.2mm (M6). Smaller and bigger sizes are available, but the crimps are rarely stocked so you’ll generally be on the hook for MOQ if you stray from this safe range.

Our manufacturer recommends 18AWG wire for all crimp terminals.

Spade terminals

spade-set

Spade or fork terminals attach easily to a bolt or screw terminal without fulling removing the screw from the terminal. We only found these in 3.2mm (M3) and 4.2mm (M4) in the market.

These work with common screw terminals and grounding bolts, but we found these really nifty PCB mount connectors (through-hole) with a single screw terminal. The manufacturer has a range with parts numbers from PCB-1 to PCB-14 that vary primarily in the height of the leads. PCB-2 is the most compact and lowest profile version, so we’ve been working with it.

Our manufacturer recommends 18AWG wire for all crimp terminals.

Blade terminals

blade-set

Male and female blade terminals connect cables to board mount connectors AND cables to other cables. Available in multiple sizes, but 2.8, 4.8 and 6.3 are the common.

There are multiple type of terminal blocks for connecting female blade connectors to PCBs or wiring harnesses. We found single PCB mount connectors (through-hole) for use with female blade crimps. The smallest versions (2.8) use 0.5mm thick metal, while the 4.8 and 6.3 version use thicker 0.8mm metal. The two bigger connectors have offset tabs to provide additional stability.

Our manufacturer recommends 18AWG wire for all crimp terminals.

Other crimp terminals

A lot of available crimp terminals are missing from this list: male and female bullet connectors, right angle blade connectors, etc. A reel of these crimps is not expensive, but most cable manufacturers don’t have the proper tooling work with them in their crimping machines. Crimp tools can range from $100 to $1000s, depending on the machine and if the manufacturer has to customize the tools.

If you’re looking to do low volume cheaply, the it’s always best to use what multiple manufacturers and distributors have available in the market.

Insulated covers

All three types of crimp terminals have compatible insulators in multiple colors. We’re not yet equipped to offer these in the dirty cables creator.

Maximum ratings

Please note that we’re unable to provide maximum ratings at this time. Our cable suppliers don’t have datasheets for the common “duff” stuff they’re using, so you’ll need to do the same due diligence on the final cables that you would if buying directly in China yourself.

We’ll need to find our own crimp terminal manufacturer and supply parts to the cable maker ourselves to get properly rated parts.

Touch it yourself: Dirty Terminals Sample Pack v1.0

Buy the kit. Can’t wrap your head around it without getting your hands on these parts? Don’t worry, we’ve got you covered. All these crimp terminals and mating connectors are available in the Dirty Terminal sample pack. Grab it in the store for $4.95.

Dirty Cables: Get your own custom cables

DirtyPCBs

Get cheap custom cables for your project, direct from Huaqiangbei. Use the Dirty Cable creator to drag and drop wires and connectors into a cable and price custom cables from quantity 100.

Taking it further

In the coming weeks we’ll cover coaxial power connectors and LED strip sockets.

Dirty Cables price increases and lead times

DirtyPCBs

Its really hard to convince Huaqiangbei market suppliers to cooperate on a project until you can prove value by making a bunch of orders. Our approach is to guestimate a price at DirtyPCBs, send through a few months of orders, and then ask if they’d like to cooperate with us. Generally this will open doors to closer integration like getting full price lists.

After a few months of running Dirty Cables we looked at our overall order history. On 75% of orders we lost anywhere from $5 to $500. This was totally expected and part of convincing suppliers to give us full pricing details.

Our current supplier makes outstanding cables, but getting a quote is still like pulling teeth and takes ages. They also seem completely uninterested in providing a full price list. We’re in the market today shopping for a new supplier, but in the meantime prices on most connectors have been doubled or more based estimates from the first few months of data. It would also be fair to say lead time is currently 10-20 days, more on large or complicated orders.

Since a lot of the loss/expense is in the low volume orders of 100 cables, we need to compensate with bigger discounts on high volume orders. Connector prices are easy to update in the back end, but volume discounts require a site update that will come towards the beginning of next week. If you’re placing a large order and think the price is too high, please contact us for a more accurate quote.

DIRTY CABLES: Cheap custom cables available now

DirtyPCBs

Dirty Cables is a drag and drop cable builder that gives you access to cheap custom cable services from China. Build a custom cable, get an instant quote, and checkout. Your custom cables should ship in 3 to 7 work days.

Huaqiangbei is full of cheap custom cable vendors with a big pile of samples on their booth. We tried to put the pile online so you can get cheap cables without making a trip to China!

cable-pile-2

We excavated the cable sample piles to see which connectors are common, cheap and readily available in the Chinese market. We bought bundles of everything and identified 17 common cable-to-cable and cable-to-board connector families to add to Dirty Cables. Read more about the different cable families here.

Cables are probably best understood by touching them yourself, so we put together a Dirty Cables Sample Kit that includes examples of each cable and connector. The kit is available in the store for $9.95.

In the coming weeks we’ll document a few more common and cheap connectors that didn’t quite fit in the first sample kit:

  • Crimp terminals: ring and spade ( M3/3.2mm, M4/4.2mm, M5/5.2mm, M6/6.2mm), two-part blades (2.8mm, 4.8mm, 6.3mm)
  • Coaxial power connectors (5.5×2.1mm, various)
  • LED strip connectors (3528/8mm, 5050/10mm, etc)

Dirty Cables is highly experimental. If pricing seems way off, if you find bugs, or if we’re missing your favorite connectors, please give us a shout in the comments or through the contact form.

How Scotty made his own iPhone in China

Over the past two months we’ve been super excited to follow Scotty’s adventure recycling/refurbishing an iPhone 6S in the used cell phone market just south of Huaqiangbei, Shenzhen, China. Scotty finds all the bits and pieces from various sellers and then follows the iFixit instructions, backwards, to build his own recycled franken-phone.

Despite living in the market and running six hacker camps, it was still not clear to us exactly what goes on in the used cell phone markets. This video blows that open and exposes the brisk trade in recycled iPhone parts here in Shenzhen.

Along with This is Not Rocket Science, Scotty also took us on a three day phone recycling expedition earlier this month. Watch his channel for more videos and clips soon!

CHINA STUFF: Email that works…

mail-dp

Working from China is a constant reminder that the location of internet services is super important. North America and Europe are just a few internet hops from our servers in Hetzner’s carbon neutral, green energy data center in Germany. From China, however, we’re often routed out through Beijing to San Jose, then to New York, London, Amsterdam, and finally Frankfurt. On a good day we can do that with only 2-3% packet loss.

Back in the good old days Gmail’s imap service worked perfectly even though Google was blocked, but eventually email was blocked too. At that point we added a managed mail server at Hetzner in Germany. Despite having our own non-blocked mail server, Hetzner’s data centers are unreachable during peak periods of the day because of peering agreements, congestion, geolocation, and a million other factors not worth arguing about.

The image above is a WinMTR report, a combination of ping and traceroute that helps locate network problems. 219.* is where we exit on China Unicom’s cable in Beijing and connect at San Jose, California. Nearly 50% packet loss, average ping time of 482ms. This is better than normal because San Jose connected directly to Frankfurt when this test was taken, instead of the more typical New York-> London-> Amsterdam route.

So how bad is it exactly? 5 tries to send a simple text email without attachments. “Failed to save draft, try again?” prompts every few seconds. Ability to see mail subject headers, but not download the message text. Want to send or receive an attachment? Better schedule that for late at night or first thing in the morning.

International bandwidth from China

There are three cable landings in China: Beijing, Shanghai, and Guangzhou. Each is dominated by one of the three state-owned ISPs. China Unicom (our provider) is big in the north with international traffic routing through Beijing and around 1TB/s bandwidth. China Telecom is big in the south (e.g. Shenzhen area) with around 2.5TB/s of bandwidth through Guangzhou. There are also a lot of bit players like Great Wall and TopWay that have city and regional backbones that eventually dump onto the major state-owned ISP infrastructure.

Part of our problem is using a northern ISP (Unicom) in the south. All of our traffic is routed to Beijing before leaving China. While we can see Hong Kong from the office and can walk there in about 15 minutes, connections to Hong Kong websites are routed up to Beijing and back for a 3000km+ journey. This isn’t our choice, Unicom has a monopoly in our Huaqiangbei office and nothing else is available.

This was intended to be an epic post using MTR to analyze the optimal routes and geographical locations to stash internet services with the best chance to be reachable from China. That idea bombed because nearly everything changed dramatically day to day. A test from yesterday is different than a test today, which will probably be different than a test tomorrow. Follow below for tests of several major email providers and their accessibility from China.

Rackspace Business Email is a disaster from China

rackspace

Over the past few months we tested a lot of email services. Rackspace is a well respected company with business email hosting for $2 per box per month. Signup from China triggered a review, so we had to call support to complete the order. The Rackspace rep volunteered that they have constant complaints from users in China, not something you want to hear. The MTR report shows why, routing to their imap server is a disaster (30% loss, 361ms average ping).

Microsoft Office365 email works great from China, but is itself a disaster

office365

Probably the most distressing part of daily life in China is using Microsoft’s Bing search engine. It’s a terrible search engine, but it’s always super fast within China. You might even find what you’re looking for if you skip directly to the third page of results, link number 5…

Microsoft’s Office365 imap mail service also works very well inside China, and at $4 per box per month it isn’t very expensive. The MTR report suggests Microsoft is running a server in Hong Kong that connects directly to China Unicom (219.*). The service is fast (21ms ping) and very accessible (very few lost packets).

(Un)fortunately Microsoft’s automatic email migration tool sprayed crap all over the place. Their suggestion was to hire an authorized partner for support. After a while all the subscription plans, conditions, and lack of support started to seem quite sleazy. We canceled when mail migration failed and they demanded 1 year commitments for each test account to help debug it.

ABCHK.net is our email hero

abchk

ABCHK.net is a hosting and email provider located in Hong Kong that specializes in email service for Mainland China. We were super skeptical that we could get a stable connection to Hong Kong, but they provided a test account that blew everyone away. 10 meg attachments? Uploaded and sent in seconds. It works perfectly at all times of the day, and the MTR report shows a direct, clean route to the imap server. No packets to destination lost, 31ms average ping.

For less than $7/month we get five mail boxes and 100GB of storage. Real people answered emails and handled the mail migration from our old server in Germany. After a month we are still extremely thrilled to be able to use email “normally” from inside China. Attachments upload and download super fast, and the server is always 100% reachable.

This applies to Unicom only!

Tests were done on commercial and residential China Unicom 100Mbps fiber connections. China Unicom is not the optimal ISP for Shenzhen though. It makes more sense to be on China Telecom with 2.5x more international bandwidth exiting just an hour north in Guangzhou. In the office Unicom has a monopoly, but we had a Telecom connection installed at home and will run the tests again on Telecom in a few days. Anecdotal evidence from other Telecom users doesn’t seem particularly promising though.

Admittedly this is all niche info, but it was hard won and seemed worth sharing here. At the very least someone in a similar situation might find this on Google. Or on Bing, page 3, result 5.

How to measure laser cut length or time?

800px-Laser_cutting_snowfla

To price laser cutting online we need to extract two pieces of info from uploaded design files. The area of a box surrounding the design, called the bounding box, is the amount of material needed. The length of all the cuts in the design can be used as a rough estimate of the cutting time consumed. Here’s where we’re at…

A dirty cheap laser cut service has been “coming very soon” for far too long. We planned to take SVG files and use a friend’s script to measure the bounding box and cut lengths. Unfortunately we never found a laser cut supplier willing to take low volume/high-mix orders and provide all the pricing info to give instant quotes.

Last week a comment at Hack a Day mentioned that dirty laser cutting is taking forever. Surprised by the interest, we asked around and found some willing suppliers. However, these suppliers only accept dxf, dwg, pdf, eps, and ps formats. SVG won’t do. Now we have a supplier but no way to give instant online quotes.

Conversion

Converting to and from SVG is plagued with wrecked arcs and curves. Potential customer dissatisfaction factor is super high. Absolutely not reliable enough for a commercial service or even for pricing.

Extracting info from CAD programs

Inkscape loads all the above formats, but we were not able to extract total path length from the command line or the shell interface. Autocad.io is an online version of AutoCAD that might be able to provide the design stats and a nice rendering, but if the API is slow or busy are customers supposed to wait minutes for their quotes?

A couple CAD programs seemed promising, but eventually we couldn’t find anything that runs on Linux and can extract the stats we need via the command line.

Measuring scripts

The script that measures PCBs in our store and at DirtyPCBs combines a bit of gerber code knowledge with some math to crank out basic stats without ever loading a CAD program. A small script to extract path length and bounding box size from dxf is very doable after a quick thumb through the spec, however nothing seems to exist online.

The learning curve to implement the dxf format and the debug time to perfect it puts this in the labor of love category. It would be a blast if we really wanted to do it, but since it’s standing in the way of a dirt cheap service that will likely never turn a profit (laser cutting is cheap and common…) there’s no resources to dedicate to writing our own.

Create g-code and simulate the cut

G-code is a popular way to control CNC mills and 3D printers. A CAM processor (yes, like the one in Cadsoft Eagle) combines information about the machine, such as cut speed, with the path in the design file to create a series of cutting steps or instructions. G-code is accepted universally, much like gerber files.

Lots of existing scripts convert dxf/pdf/eps/ps files to g-code. Once the design is in g-code there are several programs that simulate the cut and estimate the cut time (or filament used, etc). This seems like the proper way to do it. As a bonus, it lays the framework to calculate cut time and difficulty for a future DirtyCNC and DirtyInjectionMolding service.

This is as far as we’ve gotten. A dozen Python scripts on github look promising, but nothing directly outputs the info we need without a bit of hacking. We’ll continue to knock together a solution in the next few days.

Please shout out in the comments if you have thoughts on any of these methods or experience with any tool chains that might work. Help us get laser cutting online and we’ll reward you with – what else – free laser cutting service!

Image source: Adam Dingley CC BY SA

Amazon Web Service Beijing woefully inadequate for international use

aws-cn

Amazon Web Service (AWS) is a bunch of server, storage, and other internet resources. AWS datacenters are located around the world so companies can locate websites close to their customers and speed up page load times.

A couple years ago AWS started testing a center in Beijing, China. There’s all sorts of benchmarks on speed within and between AWS datacenters, but the Beijing location is restricted to registered Chinese companies so there’s very little public (English) info on it.

In March the internet in Shenzhen because nearly unusable. While access within China reaches 100Mbps, anything outside China experienced 50%+ packet drops and max speeds of a 20-50Kbps. In a desperate ploy we tried to setup a VPN within China to a better exit point – maybe AWS has a better connection to the outside world than our local ISPs. Keep in mind that this a VPN inside China, the internet is still filtered but is hopefully more consistent and usable.

Signing up for the AWS beta was pretty easy. The account reps were super helpful and spoke perfect English. Everything went smoothly aside from the rep’s utter disbelief that, yes, we are a real Chinese company not a Hong Kong Company, and yes, we don’t want a free trial tier, and yes, we can pay in RMB from a Chinese company bank account. We guess they get a lot of people trying to sign up for free service without a company because they mentioned these things a dozen times.

We setup a “medium instance” with Ubuntu, AWS cult code for a small server without throttling. First things first – apt-get update && apt-get upgrade – to bring the server up to date. Apt pulled from AWS repositories within the same datacenter in China at a shocking 64Kbps! They didn’t even break 100Kbps within their own datacenter! Holy crap. For comparison, we regularly FTP between our servers in Hetzner’s German datacenter at 100Mbps+. Pathetic.

Ok, what about the connection to the outside world? The vast majority of our web traffic exits China from Beijing on one of two cables: San Jose, USA and Tokyo, Japan. Surely we could take advantage of our good speeds within China and then slingshot international traffic at higher speeds through the “superior” AWS infrastructure. Not exactly. A file download from DirtyPCBs.com, located in a super high speed San Jose datacenter, topped out at 16Kbps. Really Amazon?

We did similar experiments with Aliyun, the Chinese version of AWS made by the Alibaba/Aliexpress people. The results were slightly better but still absolutely unusable as a gateway to the internet outside of China.

The quest for an internet solution continues…

HOW-TO: Shipping stuff from China cheap?

shippers

Tyler writes:

What method do you use to ship from China? I am trying to ship 8kg of PLA from a manufacturer in China. I want to figure out how much sea shipping (the cheapest method) would be, but no one is really able to give me a legit answer besides someone like UPS (Yeah $200 is so not happening). I just want to try to get a cheap product from China without blowing the whole cost savings on shipping.

Between DirtyPCBs and Hacker Camp Shenzhen, we’ve helped a ton of people ship bulky items all over the world. The good news is that it doesn’t have to cost $200, the bad news is it will never be that cheap for small shipments. Here’s a basic rundown of the shipping options we’ve seen in Huaqiangbei.

Shipments under 20 kilos are considered very small shipments and there aren’t really any great options. If you’re visiting China the cheapest method is to lug it back in your suitcase.

shipping

The shipping calculator on our DEV site gives these prices for 8KG by DHL to the USA. These are roughly the prices you would get through any logistics company in Shenzhen. Ignore airmail, they won’t accept packages over 2KG. DHL China through a logistics agency is the best bet at $67, around $8.35 per kilo.

susi

At 10KG and 20KG there’s a price break for air freight through DHL/FedEx/UPS. Air freight takes a few days longer, and it has to be dropped off at the logistics agent. We’ve sent 6 hacker camps and hundreds of visitors to Susie Shipper in Huaqiangbei (pictured above) because they generally have someone who speaks English. There are dozens of similar air freight agencies in the market – just look for a garage full of boxes covered in packing tape.

For 20KG+ DHL air freight we’ve seen rates from $4.50/KG to Netherlands, and $5.50/KG to UK and USA through Susie Shipper.  At 100KG UPS air freight drops to $4/KG. Air freight is highly dependent on time of year. Around the October rush prices can be 10x higher, or the service may simply not be available at all.

Sea freight is a totally different beast and 8KG isn’t nearly enough. In our limited experience, Sea freight generally starts at $1000USD in fees alone. The actual cost of a 20 foot shipping container isn’t necessarily the greatest expense depending on destination. Sea freight has a cornucopia of associated charges that stack up fast. Bill of leading, document fees, dock fees, inspection, customs, loading, unloading, warehousing, pickup, delivery, plastic pallets, etc. There are some consolidators out there, but they generally want to ship a stuff that’s on a pallet too. 8KG doesn’t seem feasible to ship by sea.

Another thing to keep in mind is that bulky items are charged by dimension, not weight.

( Length * Width * Height ) / 5000 = dimensional weight

If the dimensional weight is greater than the measured weight, then the dimensional weight it used to calculate the shipping fees. It is frighteningly easy to run up against the dimensional weight.

This is the general frustration of China for foreign hobbyists. There are unimaginable, unbelievably cheap materials here, but unless you deal in giant volumes it is exceedingly hard to take advantage of those prices. Not only does shipping add up fast, but most suppliers have no ability to accept payments in foreign currency and exchange it into Chinese RMB.

There’s a much more fun option, one that’s only slightly more expensive than your initial shipping quote. Recently people have been finding flights from the US West Coast to China for around $400 round trip. Why not pop over, explore the markets, pack your suitcase with 23KG of goodies, and “pay” for the trip with the savings on shipping.