Uncategorized

Cheap Chinese Arduino clones or Serial-to-USB with the CH340G / CH341G on MacOS Sierra

I got an Arduino UNO clone for around¬†3 euros on Aliexpress. It’s like 8 times cheaper than the original one, and, unlike the piece of shit that the Orange Pi is (check my previous post), the quality of this clone is the same as the original… Almost.

screen-shot-2016-11-03-at-19-52-28

An AlmostDuino ūüôā For 3 bucks instead of 25, who is complaining?

It uses the same Serial-to-USB CH340G chip that you can find on the USB-Serial module. Therefore, they are not directly supported on MacOS Sierra.

fvkpqkzitkljgsg-largeSerial-to-USB module.

If you google around, you will find a driver.. That kernel Panics MacOS. Seriously, it’s been the first kernel panic I’ve seen in YEARS on Mac OS.

Well, the driver is here: https://tzapu.com/ch340-ch341-serial-adapters-macos-sierra/ you have to reboot after that. It will appear at your Mac as a /dev/tty.wchusbserialXXXX and the Arduino will work as intended. Or the serial adapter like the one you see above. Both use the same driver.

Have fun!

Advertisements
Standard
Uncategorized

Orange Pi Lite and the value of communities

I am a subscriber of hackerboxes.com. It’s a great way to get into some easy projects that you would probably not do by yourself if you would have to buy everything from Aliexpress and wait 3 months for your shit to get home. It’s pretty much like hellofresh for electronics.

priorbox0010_585_350

Typical hackerboxes’ contents.

September’s box came with an Orange Pi lite – a supposedly contender on the single-board computers.

I’ve read about that before, as I read about many other single-board computers which appeared recently. They all claim to be better than the Raspberry Pi in one way or another. Or cheaper. Or both.

In fact, I have a¬†C.H.I.P. $9 computer, and it works great – if that shit had HDMI, I would buy a dozen of them. Or…. maybe not.

C.H.I.P. Рthe worst name ever to google for. But it has DOGE-quality control. Seriously.

But I digress.

Why people use those single-board machines? Basically because they are cheap as fuck and because it’s so easy to use their GPIOs. Want to attach a small screen? 2 and a half bucks and a download. Pretty much everything on the Raspberry Pi is like this.

That orange pi claimed full compatibility with Raspberry Pi. Well, it does not. The GPIOs are different, the libraries are different (and not so available), the whole Linux distribution is different. In fact, it sucks to install ANYTHING on it. Reviews after review¬†they tell how this machine sucks. How finicky it is with SD cards and power sources, how it doesn’t tell you shit before the boot, how slow it actually is, etc etc.

I remember that took me a week to make mine to boot. Then, this week, I decided to install RetroPie, a Linux distribution with emulators in mind, and play some Super Mario.

Big Mistake.

After spending hours downloading and copying the image to the SD card and not having ANY idea what the fuck was going on (the Orange Pi does not turn on the screen, a LED, nothing, until it successfully boots), I decided to go for a serial console.

Yep. I am using a serial console in 2016 because a 2016 computer can’t bother to light a fucking led when it’s on.

Interestingly, the Orange Pi’s hardware can be so great in some aspects, and suck in others. For example, it has Wi-Fi, IR, a proper reset button, it’s quad-core, etc etc. And it costs 12 bucks.

To connect the Orange Pi to my Mac, I used a USB-to-Serial (isn’t usb serial already?)¬†CH340. This:

fvkpqkzitkljgsg-large

Welcome to 1962. Here is your RS-232 connector from a Macbook Pro to a Quad-Core computer made in 2016 for US$ 12.

The Orange Pi has 3 pins for RX, TX and GND for a serial console, which you connect to this little thing and then to the Mac. Except that you need a driver for it, and the official one makes the Mac go bananas. Really. I haven’t seen a Mac have a kernel panic in almost 10 years. But there is a fix for mac kernel panic.

After that, it’s a matter of running a

screen /dev/cu.wchusbserialXXXXXXX 115200

Where XXXXX is whatever in your computer. After that, you are able to see what this piece of crap is doing before it shows anything on the screen.

img_3848My OrangePi connected to a Mac via usb-to-serial.

After using this I somehow managed to make this crap boot. But not with the RetroPie I wanted, but with the same vanilla Armbian (Debian for arm – got it?) that I had before.

And I don’t know what to do with it.

  • It’s slow as fuck.
  • It needs its own stupid power cable. It’s the worst thing about the whole machine. Seriously.
  • It’s REALLY finicky. You tell it to reboot? Good luck! It will certainly stop responding, but sometimes it can reboot. Mostly not.
  • Setting up wifi is a real pain in the ass.
  • It overscans on my HDMI tv. Their response? Get a new TV.
  • Do I need this stupid Wi-Fi antenna? It’s slower and worse than the invisible one from the Raspberry Pi 3.
  • I can’t have ANY idea about what’s going on until the machine is in the middle of Linux boot. If it worked fine, that wouldn’t be a problem, but it does not.
  • The manufacturer does not provide even their own Linux image!
  • GPIOs totally different from Raspberry Pi. No libraries work without being adapted.
  • Community support? It exists, but it’s small and a best-effort thing for a machine whose destiny is to be forgotten.
  • If I want the nintendo emulator, I need to configure it by hand as if this is Slackware in 1994.

I was reading some forums, where some nerd said that “If you want a great machine, buy [whatever], if you want marketing, buy a Raspberry Pi”. And I was thinking about that.

To run a PWM engine on the Raspberry PI, I have to import pwm in a python program. To use an SSD1306 OLED screen, all I need to do is “import SSD1306”. And so it goes.

To find solutions about your problems, there are literally thousands of sources, and literally millions of people using Raspberry Pis. All your questions are mostly answered.

After using this Orange Pi, I came back to one of my Raspberry Pi Zeros. Where EVERYTHING works.

And I got so happy to have this wonderful ecosystem. Where a kid goes from back-street kid to Ph.D student thanks to the Pi.

Standard
Uncategorized

Raspberry Pi Proto HAT

Following the previous post, you can see that I had a ribbon cable from my Pi to a T-Cobbler to a breadboard. All dangling in my kitchen. Something like this, but way less elegant:

gfd6-500x500.jpg

So I found a Raspberry Pi HAT that serves as a breadboard. This is how my Pi looks like with it and the thermal sensor from the previous post. The plastic cover under was drilled to fit the screws, so the Pi is protected from both sides:

Photo 29-09-16 23 33 31.jpgPhoto 29-09-16 23 33 51.jpg

Pretty cool, eh? I think that everybody should have at least one of his/her Raspberry with one of those attached.

Advantages:

  • It’s right on the Pi: no ribbons, no weird positions, no bullshit
  • Cheaper than a breadboard (buy for 2,26‚ā¨ on aliexpress). In fact, cheaper than a plastic cover for the Pi!
  • All signal pins are in one line. Way easier to find.
  • No need to connect ground, 3v or 5v: they are all on nice locations. (see next image)Unknown.jpeg

Disadvantages over a breadboard:

  • You can have way more space on a breadboard, although if you look at the first picture with the ribbon, a mini breadboard with a cobbler provides even less space.
  • The holes are not as tight as a breadboard, and won’t hold your wires. You turn this upside down and they all fall. They have no problems with contacts, though.
  • Can’t power it from an external source: the 3v and 5v rails come directly from the Pi. No motors with this one.
  • Needs soldering for the 40 GPIO pins.

I am not making money out of this. Just wanted to share because it’s so useful, practical and cheap. This should come standard with them, really.

Standard
Uncategorized

Temperature sensor

One of the things I always wanted to do with my solar rig is to correlate temperature with energy output. For that, I got one of these:

dht-11.png

DHT11 temperature and Humidity Sensor –¬†77 cents on AliExpress.

It is REALLY simple.

Pin 1 3.3V
Pin 2 Signal+10k ohm resistor to 3.3v
Pin 3 Nothing
Pin 4 Ground

It is said that it can withstand 5.5v – with me it didn’t work.

If it helps, that’s how I have it, but I use GPIO4. It’s the same.¬†Circuito-Raspberry-Pi-DHT112.png

IMG_2863.JPGThis is my Pi2 connected to the Solar Panels.

In order to read it, I cloned Adafruit’s git repo and installed it

git clone https://github.com/adafruit/Adafruit_Python_DHT
cd Adafruit_Python_DHT
sudo python setup.py install

I needed to upgrade Raspian from Wheezy to Jessie (which I should have done a long time ago anyway) in order for the code to run without root. After that, the code is this:

#!/usr/bin/python
import sys
import Adafruit_DHT

humidity, temperature = Adafruit_DHT.read_retry(11, 4)
print 'Temp: {0:0.1f} C Humidity: {1:0.1f} %'.format(temperature, humidity)

And that’s it. I run this on my cron script that sends this data to initialstate.com:

https://app.initialstate.com/embed/#/tiles/75P10PHsOP8lP5wwHQFtz7MqzmJowC9t

Standard
Uncategorized

Hackerboxes #10: Orange Pi

So, I subscribed to hackerboxes (link). It’s a goddamn amazing idea. It’s… okay.

I saw the amazing things they shipped on their past boxes, and I thought I would give it a go.

Then I got… Box number 10.

Someone made an unboxing:

The microsd to usb does not work. At all.

The microsd card is fake.

Took me three days of trying to make the thing to boot. I can take a Raspberry Pi Zero with a new microsd card to boot in five minutes, so I have no idea what it’s up with this one.

It might be the SD card. But it works with other machines.

This thing takes a proprietary connector, and I hate it. And it’s finicky . That’s the deal breaker. 99% of the time it does not work with normal USB connectors.

It does not deal with overscan, so it’s useless for me.¬†img_2839

Apart from that, it’s a Raspberry PI 3 from a third of the price. It is fast! But… I would not bother.

Can’t wait to have the next one. And hope it’s less crap.

Standard
Uncategorized

Showing letters on a 8×8 dot matrix display with only 3 GPIO pins on Raspberry PI

I have been playing around with connecting electronics to the raspberry pi, so I bought the¬†Sunfounder SuperKit v2 for Raspberry PI. It’s a great value and comes with everything you need to begin playing with the PI and electronics.¬†Really recommended.

711vaK78H0L._SL1000_

The book shows what to do with each of the main components (engine, display, etc). One of the components I really like is the Dot Matrix display. On their example, it is shown how to use the two shift register micro controllers in cascade, to be able to control the 64 LEDS using just three outputs (bits) from the Raspberry. As you can see on their schematics, it uses GPIO 11, 12 and 13:

4.png

With it, they have shown how to display one line or column at a time. Which is hardly what you want with this thing. In fact, they give you very unfriendly examples on how to display. Their code just shows you this:

code_H = [0x01,0xff,0x80,0xff,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff]
code_L = [0x00,0x7f,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f]

Full code on Sunfounder’s GitHub

So I decided to improve. Taking that program, I created a 6×8 binary representation of the alphabet, and I show one letter at a time. So, one can just type

display_phrase("This is a test 0 0 0") # Zero shows a heart :-)

And it will show exactly this.

My version of the code also improves on the fact that it is easier to understand how to draw with mine: You just draw in binary, from right-to-left, an 8×8 square and it will show it. The value zero is a pixel on, 1 is a pixel off.

alphabet= {'A': [0b11110011,
                 0b11101101,
                 0b11011110,
                 0b11011110,
                 0b11000000,
                 0b11011110,
                 0b11011110,
                 0b11011110], ... }

A letter A. Easy to draw like this, isn’t it? ūüôā

It also always cleanup the GPIO values, among other things. You can fork my code from GitHub.

Standard
Uncategorized

When governments fuck up, science goes down the drain. Then, next generations suffer (TLDR: Brazilian academic internet will be down)

This happens everywhere, every time.

I have seen it in Venezuela. The “socialist” government fucked up pretty much any academic research, naming it “capitalist”. Seriously, what is more socialist than sharing knowledge?

Now, after the white coup that took out the president in Brazil, the former vice-president became president. Yep, from the leech party.¬†THE¬†LEECH party. They are where money is. Since forever. So, yep, it’s a coup. But I digress.

Now that the LEECH party (should I say neo-Malthusianists?) took over, they decided to take some initiatives more…. as they say, “in order to make the country grow again” (Make america great again, anyone?). So, they are going on the classic liberalism of the 18th century: cut costs, small state, less regulation for workers, all the shebang. Without really thinking about future consequences.

The coup president wanted a PASTOR as the Minister of Science and Technology. Then after the backlash. he decided to fuse such ministry with the one for the one for communications. You know, the shit dominated by telcos everywhere. So, now, brazil has all science as a vassal to the worst companies of the continent.

Their first act: cut internet to Academia. Because science is not essential.

You know what, Brazilians? You deserve each other. You wanted it. I am gone for good.

Btw: news in portuguese: http://educacao.estadao.com.br/noticias/geral,rede-nacional-de-pesquisa-fica-sem-verba-e-pode-sair-do-ar-em-1-2-mil-campus,10000065814

Standard