ESP8266 based power meter – motivation

Having a energy saving mindset, i’m always striving to save a dime and do my contribution in order to avoid waste. That said, it’s crucial to know where we’re spending energy. Goal here is to do a project log of a ESP8266 based power/energy meter.

All started when i found out about emonCMS and i wanted to give it a go on a budget. So, i hooked up my 1st gen Raspberry Pi Model B (it’s a war machine – pics will be self explanatory) to a ATTiny85 to do the ADC stuff. Power consumption is sensed via a 30A clamp freely available in the usual chinese suppliers that will output a sine wave up to 1V depending on the load. So, it was just a matter to offset my wave (since ADC won’t love negative signals and 1V sine wave will mean 1V around 0V, or, -1V to 1V).

This was the goal:

Pretty graphs from EmonCMS project
Pretty graphs from EmonCMS project

Continue reading “ESP8266 based power meter – motivation”

Free up 1.5 GB on your Raspberry Pi

Quick way to get rid of 1.5GB of trash on your Raspberry Pi running Raspbian:

 


$ sudo apt-get remove -y wolfram-engine scratch minecraft-pi sonic-pi \

dillo gpicview penguinspuzzle oracle-java8-jdk openjdk-7-jre \

oracle-java7-jdk openjdk-8-jre libreoffice* chromium-browser

$ sudo apt-get clean

$ sudo apt-get autoremove

 

That’s it! (assuming you don’t need those packages)

I had 3.8GB used space, now at 2.3GB.  Need to know what’s taking up disk space? Try:


$ dpkg-query -Wf ‘${Installed-Size}\t${Package}\t${Priority}\n’ | egrep ‘\s(optional|extra)’ | cut -f 1,2 | sort -nr | less</div>


WordPress might mess up the code by swapping straight quotes with curly quotes.

Reverse SSH Tunnel – when you cannot SSH to your host

Sometimes you need a workaround for SSH to an host. On my case, i cannot SSH to a ppp connected Raspberry Pi, but he can SSH to every other host. Solution is simple: ppp-Pi will SSH to a remote SSH server leaving a door open. Then i can SSH to my host, and login to my Pi. Confused? I know.

There’s a pretty good explanation on StackExchange.

Continue reading “Reverse SSH Tunnel – when you cannot SSH to your host”

3G to WiFi Raspberry Pi gateway

[Edit]: Thanks Hackaday for the highlight! Part two of the hack – having a 77 year old learning how to use an Android phone – is ongoing. Proof of success: her instagram account.

After building my DIY 16.5 dBi (probably with pornographic levels of VSWR – hopefully i can get an antenna analyzer on that by the next few weeks) and proofing the concept of a feasible 3G gateway, i had to put everything inside a nice IP65 box and set it up outside. Initially i was aiming at using a modded WR703N with Rooter firmware and a Huawei E3131. After burning both of them, i had to resort to a Raspberry Pi Zero.

Principle of operation: Raspberry Pi handles the PPP session from the USB modem, creates an WiFi network via hostapd and uses iptables for the rest.

Notes on weatherproofing something

Basics first:

  • water + electronics = bad. Solution?
    • Sealed box.
  • heat + electronics = bad. Solution?
    • Sealed box with ventilation.
  • Sealed box with ventilation + electronics = moisture during low temperature. Solution?
    • Heat it when it’s cold.
  • 230VAC outside = bad idea. Solution?
    • Industrial grade 230VAC to 5VDC PSU – i used this one from Mean Well – RS-35-5 (link to manufacturer) placing it within the attic and routing 5m of 2×0.75mm2 cable outside – 6m total, minimum voltage drop.

So, this is not a trivial problem to solve. My solution? IP65 grade box (IP rating table right here) with a breathing hole, DHT22 sensor inside, DS18B20 outside, python measuring things. More details below…

Continue reading “3G to WiFi Raspberry Pi gateway”

Temperature control (DS18B20 + DHT22) with the Raspberry Pi

In order to know what’s happening inside a semi sealed box, i used a small piece of perf board and added the DHT22 and DS18B20 with 10k pullups. I also added a small push button for safely powering off the Pi if needed. It looks something like this:

My take on a temperature HAT for DS18B20 and DHT22

Continue reading “Temperature control (DS18B20 + DHT22) with the Raspberry Pi”

My take on the TP-Link WR703N Antenna Mod

There is a lot of info online on this little WR703N router, and also some guides on how to add an external antenna (check here, and here, for instance).

So, i won’t going much details, but this was the process:

Performance was greatly improved! My goal was to connect this to a colinear 8dBi omnidirectional antenna for my 3G to Wifi gateway.

Thoughts on the Huawei CRC-9 Antenna connector

Quick post on Huawei CRC9 antenna jack.

This is a very small antenna connector found on some of Huawei’s 3G broadband modems.

The jack has a ground and two pads. They are NC (normally closed) meaning that when you attach an antenna they will open up and the RF circuit will feed the external antenna instead of the internal one.

I had to dig around a lot to find some info on this, and found a russian site with some info.

CRC-9 principle of operation. pin 1 is the antenna jack, pin 2 is the internal antenna.

Detail of the connector:

Pin 1 is the antenna jack, pin 2 is the internal antenna.

Why is this relevant? Because i didn’t had a CRC-9 pigtail around and had to solder coax directly to the board. Yes, it works. No i don’t recommend. This was hooked up to my DIY yagi antenna.

Huawei E3131 external antenna mod

DIY 2100MHz / 3G Yagi Antenna

Part of my family lives in a very remote location. There’s only AM and FM radio, i need to boost DVB-T signals from a repeater 40km away, and the phone landline fails around a week a month (trees falling and stuff).

So i had the idea to build a 3G/Wifi gateway. I didn’t wanted to spend 30€ on a comercial antenna to check if i had the required signal so i built my own.

It’s important to state that this was a trial: this build was never intended as a final product since this yagi wouldn’t stand a chance to strong winds.

Finished v1.0 build.

Continue reading “DIY 2100MHz / 3G Yagi Antenna”

How to block Facebook’s sponsored posts – (i.e., ads)

Annoyed by the amount of “sponsored” posts in Facebook lately? uBlock won’t block those? Here’s a quick tip and sanity saver.

 

1. Install Tampermonkey (or the equivalent for your browser) and enable it.

2. Visit the “Facebook unsponsored” page and click the green Install this script button.

3. Refresh your Facebook page.

Source.

[HOWTO] Searching the internet for the TCP-32764 netgear exploit

This is a backdoor from last month. You can find it in GitHub.
Here, i’ll describe a quick and dirty way to search the internet for this exploit.

This exploit allows complete control of the affected host. You can download/upload files, get a root shell, PPPoE credentials, admin password, etc.

The idea was originally posted here, however, the post didn’t described how to do it. So, i’ll post a very quick post on how to do it.

DISCLAIMER: educational purposes only. Use at your own risk. I only wrote the minimalist bash script and the how to.

Some more info from the author of the exploit.

Probable source of the backdoor:

Backdoor LISTENING ON THE INTERNET confirmed in :

  • Linksys WAG120N (@p_w999)
  • Netgear DG834B V5.01.14 (@domainzero)
  • Netgear DGN2000 1.1.1, 1.1.11.0, 1.3.10.0, 1.3.11.0, 1.3.12.0 (issue 44)
  • Netgear WPNT834 (issue 79)
  • OpenWAG200 maybe a little bit TOO open 😉 (issue 49)

Backdoor confirmed in:

Backdoor may be present in:

Continue reading “[HOWTO] Searching the internet for the TCP-32764 netgear exploit”