App note: USB Mass storage class on an Embedded Host

in app notes by DP | 0 comments

application note1

Microchip’s application note (PDF!) on USB Embedded Host Mass Storage class:

With the introduction of Microchip’s microcontrollers with the USB OTG peripheral, microcontroller applications can easily support USB Embedded Host functionality. One of the most common uses of this capability is to interface to mass storage devices, such as USB Flash Drives and memory card readers. These devices utilize the USB Mass Storage Class.

Building a low cost wifi camera

in DIY, wireless by DP | 6 comments

IMG_3759-600

Johan Kanflo designed a Esparducam board and built a low cost wifi camera with an Arducam Mini and a ESP8266 Wifi module:

Sometime ago I came across the Arducam Mini which is quite a nice camera module from UCTronics. It is a small PCB with a two megapixel OmniVision OV2640 sensor, an interchangeable lens and an FPGA to do the heavy lifting of image processing and JPEG encoding. Priced at around 24 Euros (lens included) you can easily buy a few without hurting your wallet and combined with an ESP8266 you can build quite a low cost wifi camera. Or several. Because designing and building PCBs is both fun and inexpensive I designed a board to go with the ESP8266/Arducam Mini combo, aptly named the Esparducam. And uniquely named too, try googeling for “esparducam“. Heck, even the domain name is available at the time of writing :)

More details at Johan Kanflo’s blog.

Project files are available on Github.

Posted in DIY, wireless | Tagged , , | 6 Comments

Free PCB coupon via Facebook to 2 random commenters

in Free PCBs by DP | 0 comments

BP

Every Friday we give away some extra PCBs via Facebook. This post was announced on Facebook, and on Monday we’ll send coupon codes to two random commenters. The coupon code usually go to Facebook ‘Other’ Messages Folder . More PCBs via Twitter on Tuesday and the blog every Sunday. Don’t forget there’s free PCBs three times every week:

Continue reading →

Output voltage control of DC/DC converters

in how-to by DP | 1 comment

ipp

Thomas Fischl writes:

Some applications needs to control the output voltage of a dc/dc converter instead using a fixed output voltage. For example battery chargers has to adjust the output voltage to the current battery level. This page shows how to add such a control function to a buck converter circuit.

Control output via external voltage source
Typically a voltage divider is used in dc converters to adjust the output voltage to the needed feedback voltage. To control the feedback signal by an external voltage source, a third resistor is added to the circuit.

More info at Fischl’s site.

Posted in how-to | Tagged , | 1 Comment

HOW TO: China import/export permit and company bank

import-export

Last week we described the painful process of opening a Chinese company. That was actually the fast and easy part. There’s still a pile of paperwork and months of waiting ahead. This week we look at the proper, and improper, ways to export from China.

A Chinese import export permit is permission to exchange foreign money to Chinese RMB, and refund sales / VAT tax on exported products. Imports, exports, and foreign currency exchange are attached to your permit number. Any trader operating in China without one is illegally exporting and violating the currency control laws, and is not a reliable supplier in our view.

Our license was handled by an agent, we literally did nothing but hand over the company documents. It took about a month and cost around 5000RMB ($900USD). It isn’t hard to get, but is difficult to use for small scale stuff. Our giant CPA firm even botched our first attempt to get a VAT tax refund. Continue below for more on the right and wrong way to export from China, and a summary of the crisis that almost ended our Chinese company this week.

How to export from China. The legal way. 

This is the biggie. It took lots of trial and error, but to the best of our knowledge this is the proper way to export products from China and receive payment in foreign currency.

1. Receive foreign currency (USD,EUR, etc) payment by wire to the company bank account

2. Go to the bank, show an invoice for products and the import export permit

3. Money is converted to RMB. The amount and purpose is reported to government

4. Purchase products and get the official ‘fapiao’ VAT tax receipt

5. When the products leave China get a stamped export declaration form from the shipper

6. Take the VAT tax receipt and export declaration form to the tax office to rebate the 17% VAT tax. Many people skip this step. It is quite a hassle with very specific timing requirements. Unless you ship a container load of the same thing, or something very expensive, it is generally not worth the effort to get a VAT refund

7. Give the export declaration form to the accountant. The government will audit to see if the amount of currency converted to RMB matches the products exported

The tricky thing is the export declaration form. It is not a simple commercial invoice or proof of shipping. It has to come from an authorized authority with the correct stamp. It costs 300RMB ($50USD), and you need one for each package exported!

export-proof

For example a simple 5x5cm $14 Dirty PCBs order. To convert that payment to RMB to pay the factory and refund the 17% VAT we need an export declaration form that costs $50 for this order alone. Unpossible.

Why are we still doing this?

So how do you deal with this? Hong Kong company to the rescue! Instead of shipping individual orders directly to hackers from China, we export the PCBs in bulk to Dangerous Prototypes Limited Hong Kong. For a while it looked like we had to rent a warehouse in Hong Kong and hire people, but eventually we found a service to do it for us.

Xiao Tang packages PCBs into boxes and puts on all the postage labels in China. A logistics company picks up the boxes, imports them to Hong Kong as a single shipment, and drops them at the post. They charge 300RMB to handle the customs export inspection and prepare an export declaration form. Now we can exchange money to pay suppliers and refund VAT.

It seems like Seeed Studio has had to make big changes to comply with this in preparation to go IPO. Small(er) Chinese companies have a different standard of accounting and compliance requirements, but when you take a bunch of government money and prepare for public listing many more rules apply.

We’ve noticed our stuff go out of stock at Seeed a few times recently, evidently while they move between Hong Kong warehouses. Our guess is they had to ship all or most of their stock to Hong Kong to refund the VAT and get the export declaration form required to exchange currency.

We’re a WFOE, which means we are held to the highest standard from day one.

How to export from China. The wrong way.

There’s a number of loopholes and unsavory practices foreign and Chinese agents use to circumvent the currency control system.

The process we describe above is only to pay for products. Payments for services can be converted with a simple invoice. So a small Chinese company might do a production run of 100 PCBs, but bill the client for consulting services. This seems so widespread for small stuff that bankers and accountants openly encourage it.

Each individual can freely convert $50,000USD to RMB each year. According to our CPA, around 70% of foreign business with Huaqiangbei market traders is paid to the boss’ personal account. This way the boss avoids paying VAT, and they don’t need an export declaration form to convert foreign currency to RMB. We won’t pay suppliers this way until a lawyer says it is actually legal to convert funds for business. Even if it is legal, $50,000 doesn’t go far for any sizable production.

A variant on the above is to recruit Chinese people to “rent” you their yearly allotment. You wire $50,000 to their account and they keep a percentage. This is so fraught with risk and uncertainty it hardly seems like a way to run a company, but it does seem like a good way to have your money stolen…

Importing

No experience here yet, but some general observations.

The import export license can be used to import and pay taxes on stuff coming into China. For example microcontrollers. Tax is generally 17%, and can be refunded when the chips are exported in a finished product. It is a bit of a hassle, especially for a small production run, but it is very doable.

In practice, almost everyone doing production in China has some variant of a story where they smuggle chips into the country in a backpack, pants pocket, etc. Foreign engineers becoming smugglers and tax cheats, over a 17% tax that’s refundable.

Supply chains are delicate enough already, you want to throw SMUGGLING into the mix!?!? Do you want your production held up for a month while you re-source chips because you got busted smuggling them into China to cheat a 17% tax? Then DON’T SMUGGLE!

Always ask your Chinese supplier for a copy of their import export license! It is at least moderate assurance your money won’t be stolen on the way into the country, and that your products won’t be confiscated on the way out.

Open a company bank account

cmb-logo

So after months and months of work we finally have a Chinese company! But wait, it isn’t really useful with out a bank account that can convert foreign currency to RMB. This took nearly three more months.

Here’s the strange thing: Chinese banking rocks. Fees are non-existent or super duper low. Foreigners can walk in off the street, open a personal account, get an ATM card on the spot, and sign up for internet banking, all for free with a small initial deposit (~$20USD, ~120RMB).

Business banking is a whole other thing. First we went to Bank of China, cause, you know, they’re huge and international. They wanted to schedule a call in a week to setup an appointment for next month, not ok. We visited PingAn, ICBC, Communications Bank, and a few other smaller banks that weren’t even licensed to work with foreign owned companies.

Eventually we landed with China Merchant’s bank, simply because they would actually meet with us. Pro tip: choose a bank close to home or office, you or your employees will be spending a day a week there for as long as the company operates. Almost every major transaction needs to happen in person.

bank-cert

After more than a month we received permission to open a bank account from the People’s Bank Of China central banking authority. At this point the import export permit was finished and we entered another month of waiting for approvals before the account was open.

Capital injection

verification

Even with a bank account and import export license we still can’t run the damn company. We have to “inject” the 400,000RMB of capital, then convert it from USD to RMB.

operatingexpenses

The 400,000RMB in foreign currency is wired from the business owner, the HK company, to a special single-use capital injection account. When the money arrives, appear in person to convert up to 300,000RMB per day for operating expenses.

If you want to withdraw and convert capital to pay a supplier, say for PCBs, you have to submit already-paid tax receipts. Our accountant describes this as an “incomplete system”: you can only use company money to buy products, but you can’t get company money until you can prove you paid for the products and taxes. We had pay for stuff with personal money pulled from an ATM machine so we could get the tax receipts so we could get money out of the company. Which came first: the chicken or the fapiao?

Online banking

cmb

China Merchant’s Bank has reasonably workable English (likely Windows only) crapware for managing accounts. It comes with two USB certificates, one for the accounting department and one for the administrator.

Each transfer is first entered by the accounting department login, then the administrator has to login and approve. It’s pretty burdensome for a small business.

enough-fun

At least the developers seem to care about the user experience. “Check if there is enough fun”. Indeed.

For the big ones, not the small ones

One theme that keeps popping up: China is still built for big business. The plus side is a real company with real no-bull expenses and tax deductions. But, while the bank software would be great for an organization of 100+, but it stinks for a couple hackers who want to export a few PCBs. Similarly, it is easy to export a shipping container load of stuff, refund VAT, and convert payment to RMB, but you gotta hack the system to ship a $14 PCB order.

Maybe this is why such a large gray market export economy is allowed to thrive in China. Foreign and local agents are exporting products, which China encourages, but the system is incomplete and overly burdensome for small companies and individuals to be fully compliant.

A blind eye approach could be much more effective than reworking the whole system. After all, currency control largely exists to prevent big (foreign) interests from speculating and manipulating the Chinese economy. The spirit of the law isn’t to bust an eBay Arduino seller for illegal exports.

Wrap-up

For those of you following along on WeChat #shenzhen_hacker_bei, some of this might seem familiar. We reviewed our business plan with the accounting firm multiple times, but still had a moderate crisis last week.

The accountant specifically told us, in writing and on multiple occasions, that a fapiao tax receipt was sufficient to get a VAT refund. We show up with fapiaos from the PCB factory for a refund. They pull out the example export declaration form – no refund without it, and by the way, no currency conversion either. It was obvious our accountant simply had not done it before. Rather than ask the head CPA, she just parroted incorrect conventional wisdom from her colleges. Idiots.

For most of the week we thought we were tanked. After multiple visits with lawyers and accountants we pieced together the full picture described in this post, and it seemed impossible to continue without renting a Hong Kong warehouse.

Yesterday we finally found the logistics agent willing to handle the export for us and provide an export declaration form. Hopefully these extended write-ups save someone anguish in the future.

Company. Check. Import export license. Check. Bank account with money. Check and check! But wait! We still need the work permit and residency permit! Add another 2 months before we can actually run the company. More on that process next week.

 

#FreePCB via Twitter to 2 random RTs

in Free PCBs by DP | 0 comments

BP-600x373

Every Tuesday we give away two coupons for the free PCB drawer via Twitter. This post was announced on Twitter, and in 24 hours we’ll send coupon codes to two random retweeters. Don’t forget there’s free PCBs three times a every week:

  • Hate Twitter and Facebook? Free PCB Sunday is the classic PCB giveaway. Catch it every Sunday, right here on the blog
  • Tweet-a-PCB Tuesday. Follow us and get boards in 144 characters or less
  • Facebook PCB Friday. Free PCBs will be your friend for the weekend

Some stuff:

  • Yes, we’ll mail it anywhere in the world!
  • Check out how we mail PCBs worldwide video.
  • We’ll contact you via Twitter with a coupon code for the PCB drawer.
  • Limit one PCB per address per month please.
  • Like everything else on this site, PCBs are offered without warranty.

We try to stagger free PCB posts so every time zone has a chance to participate, but the best way to see it first is to subscribe to the RSS feed, follow us on Twitter, or like us on Facebook.

ESP8266 troubleshooting guide

in how-to by DP | 0 comments

all_esp_modules_featured

Rui Santos has written an article on SP8266 troubleshooting guide:

The ESP8266 has a few common issues, specially when you are trying to flash a new firmware or uploading scripts.
This is a companion guide to the Home Automation using ESP8266 and Password Protected Web Server eBooks.

Here’s a compilation with some of the most common problems with the ESP8266 and how to fix them.

More details at randomnerdtutorials.com

Posted in how-to | Tagged , | Leave a comment

App note: Thermal behavior of small-signal discretes on multilayer PCBs

in app notes by DP | 0 comments

an_nxp_an11076

App note from NXP Semiconductors about multilayer PCB as additional heatsink for flat SMD components mostly power transistors to dissipate heat. Link here (PDF)

This application note illustrates how to improve the power dissipation of discrete components by using multilayer PCBs. It focuses on the impact of using larger copper areas to improve the thermal behavior of applications.

Posted in app notes | Tagged , , | Leave a comment

Free PCB Sunday: Pick your PCB

in Free PCBs by DP | 46 comments

IRToy

We go through a lot of prototype PCBs, and end up with lots of extras that we’ll never use. Every Sunday we give away a few PCBs from one of our past or future projects, or a related prototype. Our PCBs are made through Seeed Studio’s Fusion board service. This week two random commenters will get a coupon code for the free PCB drawer tomorrow morning. Pick your own PCB. You get unlimited free PCBs now – finish one and we’ll send you another! Don’t forget there’s free PCBs three times every week:

Continue reading →

Posted in Free PCBs | Tagged | 46 Comments

App note: Enhancing cellphone battery performance during GSM pulses through the use of a parallel supercapacitor

in app notes by DP | 0 comments

an_avx_EnhancingCellphoneBatteryPerformance

Low ESR and ESL supercapacitor paralleled to cellphone batteries can react more quickly to the demanding power required by GSM pulses. A great appnote read from AVX, link here (PDF)

With the constant addition of features and functionality, battery life and reliability are becoming increasingly vital to those who rely on their smartphones. The transmission signal requires quick pulses of current from the battery, potentially causing the instantaneous voltage of the battery to drop below the phone’s minimum voltage of operation. This may cause the power to the battery to be temporarily interrupted. A series of tests were performed on multiple battery chemistries to determine the beneficial effect of placing an AVX supercapacitor in parallel with the battery, to improve the life of the battery as well as the quality of power provided from it.

App note: QuickBoot method for FPGA design remote update

in app notes by DP | 0 comments

appps

A QuickBoot method for FPGA design remote update application note (PDF!) from Xilinx:

This application note presents detailed descriptions of the QuickBoot method that are important for evaluating the QuickBoot solution and debugging implementation problems. Demonstration implementations of the QuickBoot method are provided for the KC705 evaluation board using the serial peripheral interface (SPI) flash or byte-wide peripheral interface (BPI) flash. See KC705 Board Demonstrations, page 33 to run the QuickBoot demonstrations on the KC705 evaluation board.

App note: High voltage adjustable power supplies

in app notes by DP | 0 comments

 

app2

TI application note (PDF!) on high voltage adjustable power supplies:

An improved approach is shown in Figure 2. Here an LM329B 6.9V zener reference has been stacked in series
with the LM317’s internal reference. This both improves temperature stability, since the LM329B has a guaranteed TC of ±20 ppm/˚C, and improves regulation, because more loop gain is available from the LM317.
These techniques can be extended for higher output voltages and/or currents by either using better high voltage transistors or cascoding or paralleling (with appropriate emitter ballasting resistors) several transistors. The output short circuit current, determined by R3, must be within Q2’s safe area of operation so that secondary breakdown cannot occur.

Free PCB coupon via Facebook to 2 random commenters

in Free PCBs by DP | 0 comments

BP

Every Friday we give away some extra PCBs via Facebook. This post was announced on Facebook, and on Monday we’ll send coupon codes to two random commenters. The coupon code usually go to Facebook ‘Other’ Messages Folder . More PCBs via Twitter on Tuesday and the blog every Sunday. Don’t forget there’s free PCBs three times every week:

Continue reading →

Arduino MPPT solar charger shield

in Arduino, DIY by DP | 1 comment

20160119_projekte_028

Lukas Fässler made an MPPT solar charger project and wrote a post on his blog detailing its assembly:

The basic idea behind an MPPT solar charger is simple. A solar panel has a certain voltage (in the region of 17 to 18 volts for a 12 volts pannel, somwhat dependent on temperature) at which it provides most power. So as long as the battery needs charging, you want to pull just as much current to reach this voltage. But once the battery is full you need to avoid overcharging the battery. So you want to maintain a maximum voltage for your battery (somewhere around 13.8 volts for a 12 volt lead acid battery) and no longer care about the pannel’s voltage.

Project info at Soldernerd site.

ESP8266 – Wireless weather station with data logging to Excel

in tutorials, wireless by DP | 3 comments

Wireless-Weather-Station-with-Data-Logging-to-Excel-thumb-600

Rui Santos writes, “In this project we are going to establish a wireless communication between two ESPs and send data from three sensors to an Excel spreadsheet. This tutorial shows a wireless weather station with data logging that you can implement in your home.”

Project info at Random Nerd Tutorials site.

Datalogging Accelerometer Data To An SDCard

in MSP430 by DP | 0 comments

msp430_datalogger_sdcard

MindForge built a datalogger project which logs accelerometer values to an SDCard:

This project started as an EMG datalogger to study my dad’s Parkinson’s disease, but after some testing I determined wearing electrodes wasn’t practical for the long term datalogging that I wanted to do, the data ended up very noisy due to RF interference and shoddy electrode to skin connections.
I moved away from the EMG idea and began working on a low-cost low-power consumption accelerometer datalogger instead.

Via 43oh.

Posted in MSP430 | Tagged | Leave a comment

#FreePCB via Twitter to 2 random RTs

in Free PCBs by DP | 0 comments

BP-600x373

Every Tuesday we give away two coupons for the free PCB drawer via Twitter. This post was announced on Twitter, and in 24 hours we’ll send coupon codes to two random retweeters. Don’t forget there’s free PCBs three times a every week:

  • Hate Twitter and Facebook? Free PCB Sunday is the classic PCB giveaway. Catch it every Sunday, right here on the blog
  • Tweet-a-PCB Tuesday. Follow us and get boards in 144 characters or less
  • Facebook PCB Friday. Free PCBs will be your friend for the weekend

Some stuff:

  • Yes, we’ll mail it anywhere in the world!
  • Check out how we mail PCBs worldwide video.
  • We’ll contact you via Twitter with a coupon code for the PCB drawer.
  • Limit one PCB per address per month please.
  • Like everything else on this site, PCBs are offered without warranty.

We try to stagger free PCB posts so every time zone has a chance to participate, but the best way to see it first is to subscribe to the RSS feed, follow us on Twitter, or like us on Facebook.

HOW TO: Start a Chinese Company

foreign-invest-cert

While Shenzhen is becoming “Hollywood for Makers”, and not always in a good way, there don’t seem to be a lot of foreign open hardware/maker/start-up/accelerated/innovated/incubated people starting Chinese companies. As far as we know, we are the first foreign owned open hardware centric Chinese company in Shenzhen. With everything going on here, we definitely wont be the last.

There are three reasons foreigners start a Chinese company: to sell to China’s domestic market, to get legal residency, and to work with small suppliers who can’t accept foreign currency. We are only interested in the latter.

Working with a controlled currency

rmb-note

Chinese RMB is a controlled currency. Money only goes in and out of China for certain purposes, in allowed amounts, with the proper license. Most small Chinese suppliers don’t have an import/export license (and dodge taxes) so they can’t convert payments made in a foreign currency.

compression-molding

That’s why it is almost impossible for you, from abroad, to work with the small, flexible, inexpensive Chinese suppliers we have access to. If you really want to make small scale supply chain mash-ups, say 100 traffic-themed adult novelties, then tiny suppliers are crucial and they must be paid in RMB.

Continue reading →

Maker’s rule, the feature packed PCB multi-tool

in tools by DP | 0 comments

pics
Rohit Gupta made a more refined version of his tinker rule:

My initial scale was big and not handy, So, this one should be small and compact and must not miss a single feature from its ancestor. This one has :

  • 0.1 inch grid to quickly prototype/resolve parts for perf-boarding or part creation
  • A collection of footprints and holes to quickly compare parts
  • A small pad with a sand paper to rust off those berg strips/resistor ends that just wont solder located ergonomically at the end to allow easy motion
  • A key chain form factor
  • A LED Tester
  • A continuity tester compatible with most common 4.5mm banana plug type probes and alternatively alligator clips too
  • A reference section for common equations,scales and track widths.
  • 0.1 inch scale at right angles
  • 1 mm resolution scale at right angles

Project info at Rohit Gupta’s blog.

Via the contact form.

 

 

Posted in tools | Tagged | Leave a comment