App note: Low-Power Real Time Clock

in app notes by DP | 4 comments

apps1

An application note (PDF!) on low-power real-time clock from Microchip:

This application note uses the Timer1 module, from a mid-range PIC16CXXX microcontroller, to control a low-power real-time clock. Timer1 was chosen because it has its own crystal which allows the module to operate during sleep. The two events that will wake the device from sleep (for this application) are a keypress and a Timer1 overflow.

Free PCB coupon via Facebook to 2 random commenters

in Free PCBs by DP | 2 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 →

Posted in Free PCBs | Tagged | 2 Comments

‘Magic tree’ project

in DIY, sensors by DP | 0 comments

TREE-ORGAN-PROTOTYPE

Dilshan Jayakody has published a new build, a ‘Musical trees’:

“Musical trees” is a part of creative arts installation and this project is capable to produce different audio tones by detecting human touch to its attached plants. Existing version of this driver is capable to monitor 8 plants and produce different sounds for each plant.
This project is build around PIC16F628A 8-bit microcontroller and PT2399 echo processor IC. To drive the sensor electrodes we use pair of CD4011 quad 2-input NAND gate ICs. This prototype use TDA7052 1W audio amplifier IC to drive the speaker(s).

More details at Jayakody’s blog.

Check out the video after the break.

Continue reading →

mavroOBD, an open source Arduino compatible OBD/Can-Bus module

in Arduino, DIY, hacks by DP | 0 comments

mavroOBD-rev3-1

Mavromatics’ open source project designed to “hack” your vehicle, that is available on github:

The goal of this project it to create an Arduino based OBD port module that can be used to enhance a vehicles capabilites. For example, if you want door locks to close when moving faster than 5mph or to invoke/emulate certain CANbus buttons automatically at start up.

Project info at Mavromatis’ blog.

flip-flop/BCF project

in DIY by DP | 0 comments

DSCF0983_zps1vqznsvo-600

Ray over at the diyAudio forum has been working on his flip-flop/BCF project:

I’ve just finished a project to roll up the developments into a more ‘finished’ build, feeding the balanced outputs from the flip-flop board into a Broskie BCF buffer stage. I’m using Nicks MJ Statistical Regulator for the B+ and one of Andrew’s indirect filament supplies

Project info at diyAudio forum.

Posted in DIY | Tagged , | Leave a comment

#FreePCB via Twitter to 2 random RTs

in Free PCBs by DP | 1 comment

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.

Posted in Free PCBs | Tagged | 1 Comment

Using “Ultracapacitors” as a power conditioner and ballast for transient high-power loads (or “How to run your HF rig from D-cells” – sort of…)

in how-to by DP | 0 comments

cap_ballast_bank_2a

KA7OEI writes:

An advantage of Lead-Acid, NiCd, Lithium Ion and some NiMH cell types is that they have quite low internal resistance compared Alkaline cells: Even an aging lead acid battery that is near the end of its useful life may seem to be “OK” based on a load test as its internal resistance can remain comparatively low even though it may have lost most of its storage capacity!
One could ask, then, why now simply parallel Alkaline cells, with their ready availability, long life and high storage capacity with one of these other cell types and get the best of both worlds? In theory you could – if you had some sort of charge control circuitry that was capable of efficiently meting out the energy from the alkaline pack and using it to supplement the “other” storage medium (e.g. lead-acid, lithium-ion, etc.) but you cannot simply connect the two types in parallel and expect to efficiently utilize the available power capacity of both types of storage cell – this, due to the wildly different voltage and charge requirements.
Even if you do use a fairly small-ish (e.g. 7-10 amp-hour) lead-acid or lithium-ion battery pack, even though its internal resistance may be low compared to that of alkaline packs, it likely cannot source the 15-20 amp current peaks of, say, a 100 watt SSB transceiver without excess voltage drop, particularly if it isn’t brand new.

This is where the use of “Ultracapacitors” come in.

Details at KA7OEI’s blog.

Bus Pirate v3.8 free PCB build

in builds by DP | 3 comments

finished-large-600

Ilias Giechaskiel blogged about his free Bus Pirate v3.8 PCB build.  The Bus Pirate is an open source hacker multi-tool that talks to electronic stuff.

The next step was to burn the bootloader onto the Bus Pirate. Though I have found a couple of good resources for this already (1 and 2), I needed to modify a few steps as I was running Linux (also, the second link is in Spanish, so repeating some of what it says in English is probably a good thing). Though I already owned a PICkit 3, I hadn’t yet used it, as I tend to work with Atmel chips, so I first had to install the toolchain.

If you build a free PCB we’ll send you another one! Blog about it, post a picture on Flicker, whatever – we’ll send you a coupon code for the free PCB drawer.

Get your own handy Bus Pirate for $30, including world-wide shipping. Also available from our friendly distributors.

HOW TO: Shenzhen Spring Festival/Chinese New Year

in Shenzhen by Ian | 3 comments

aeon2

By 2016 most hackers have some idea that China shuts down for a month every year. If not, learn it: from some time in January to some time in February the world’s largest country and manufacturing capital, one of the biggest economies, closes shop. Nothing is made or shipped.

While the whole country celebrates, Shenzhen is uniquely populated entirely by migrant workers from the north who leave for Spring Festival. All the teenagers who live in dorms and build your iPhone make a once yearly trek to see their families. The mass exodus from Shenzhen to northern China is billed as the worlds largest human migration. Its documented in “The Last Train Home”.

luggage-dragger-1

It starts slowly at first. You see a few people dragging luggage down the street, then a few more. Suddenly they’re everywhere.

Continue below for fireworks, gambling, the great migration, and how to deal with suppliers during Chinese New Year.

Continue reading →

Crystal Ladder filter

in PCBs by DP | 2 comments

crystal_ladder_filter

Dan Watson writes:

Here’s a little board for making a four pole crystal ladder filter.
This type of filter has a very high Q and narrow bandwidth, allowing you to select a specific frequency from your signal. Because of the narrow bandwidth, selection of the capacitors and tuning of the filter is important to achieve the desired response. You will want to test your filter after designing and assembling it to verify performance.

Project info at The Sync Channel blog.

Posted in PCBs | Tagged , | 2 Comments

App note: Auto-zero amplifiers ease the design of high-precision circuits

in app notes by DP | 0 comments

an_ti_slyt204

An application note from Texas Instruments on new chopper amplifers superiority over old design chopper amps. Link here (PDF)

This article shows that the auto-zero calibration technique is very different from the chopper technique and is one that, when implemented through modern process technology, allows the economical manufacturing of wideband, high-precision amplifiers with low output noise.

Free PCB Sunday: Pick your PCB

in Free PCBs by DP | 48 comments

BP-600x373

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 | 48 Comments

App note: Transmitting SXGA video signal through 1kft (300m) CAT-5 cable

in app notes by DP | 0 comments

an_intersil_an1318

An app note from Intersil on utilizing CAT-5 cable for SXGA video transimission. Link here (PDF)

The goal of this application note is to present the most current design methods for transmitting high bandwidth SXGA video signal over long distances of CAT-5 cable (300m or more). The enormous cost benefits of CAT-5 cable will also be discussed; for instance, the average cost of a 100m of CAT-5 cable is $20 while the average cost of a 100m of Coax Cable could easily exceed $240. Furthermore, wiring is reduced from a bulky hard to manage bundle of 3 cables to 1 easily pulled cable. Additionally, CAT-5 cable has a 4th twisted pair available, which can be used for KVM signal, audio, timing or control signal transmission.

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 | 7 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 , , | 7 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.