Skip to content

Instantly share code, notes, and snippets.

@mattiarossi
mattiarossi / rboard_01
Last active December 20, 2015 08:49
Arduino Rboard Code to drive two sump pumps
#include <Wire.h>
long pumpLatency = 5000;
long pump2Delay = 60000; // Time (in millis) to delay pump2 activation
long sw1Delay = 180000; // Time after which to enable pumps even if sw2 is not active
// Don't want water to rest there unnecessarily
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int R0 = 4;
@mattiarossi
mattiarossi / emonTx_CT123_Voltage_pump_id11_i2c.ino
Created August 26, 2013 09:51
emonTx firmware, three CT sensors, one temperature, retrieves data from I2C and forwards it to emonBase
#include <DallasTemperature.h>
#include <OneWire.h>
#include <JeeLib.h>
#include <Ports.h>
#include <PortsBMP085.h>
#include <PortsLCD.h>
#include <PortsSHT11.h>
#include <RF12.h>
#include <RF12sio.h>
@mattiarossi
mattiarossi / Iboard_Emoncms_pinchange_power.ino
Last active March 30, 2017 10:50
Uses an arduino and the pinchangeint library to implement an energy monitor that reads pulses from a power meter that has an open collector pulse output like the Finder 7E.23.8.230.0001: http://www.findernet.com/media/series/7E/EN/S7EEN.pdf Logs power readings to an emoncms instance (http://www.emoncms.org)
/*
Many meters have pulse outputs, including electricity meters: single phase, 3-phase,
import, export.. Gas meters, Water flow meters etc
The pulse output may be a flashing LED or a switching relay (usually solid state) or both.
In the case of an electricity meter a pulse output corresponds to a certain amount of
energy passing through the meter (Kwhr/Wh). For single-phase domestic electricity meters
(eg. Elster A100c) each pulse usually corresponds to 1 Wh (1000 pulses per kwh).
@mattiarossi
mattiarossi / pulsecounter_simulator
Created October 6, 2013 21:55
A simple sketch to simulate multiple pulse counters using analog outputs 0-5 of an arduino
#define triggerDelay 90
#define channels 6
#define ppw 1
int pins[channels] = {A0,A1,A2,A3,A4,A5};
int wattshour[channels]={6000,5000,4000,3000,2000,1000};
int pulseStatus[channels]={0};
unsigned long pulseInterval[channels]={0};
@mattiarossi
mattiarossi / totalSize
Created December 9, 2013 08:48
Shell script to find total file sizes using a certain pattern
ls -l `find . -name \*.mp3` | awk '{ x += $5 } END { print "total MB:" x/(1024*1024) }'
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <PubSubClient.h>
//Def
#define HVAC_TOSHIBA_DEBUG; // Un comment to access DEBUG information through Serial Interface
#define ONE_WIRE_BUS 10 // DS18B20 on arduino pin10 corresponds to SD3 on ESP8266 Dev Board
#define NUMROOMS 5
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Author: mattiarossi
# @Date: 2016-03-27 23:29:25
# @Last Modified by: mattiarossi
# @Last Modified time: 2016-03-28 23:25:55
import time
import threading
import minimalmodbus
{
"variables": {
"user_ocid":"{{env `user_ocid`}}",
"tenancy_ocid": "{{env `tenancy_ocid`}}",
"fingerprint":"{{env `fingerprint`}}",
"private_key_path":"{{env `private_key_path`}}",
"availability_domain": "{{env `availability_domain`}}",
"region": "{{env `region`}}",
"base_image_ocid": "{{env `base_image_ocid`}}",
"compartment_ocid": "{{env `compartment_ocid`}}",
---
title: "Statistiche Covid 2020 - Italia"
output:
html_document: default
pdf_document: default
---
```{r setup, include=FALSE}
requiredPackages <- c("readr", "dplyr", "ggplot2", "ggthemes", "scales", "extrafont", "knitr")
@mattiarossi
mattiarossi / getMarketplaceImageId
Created May 18, 2020 20:46
Fetches an OCI Marketplace listing resource id
#!/bin/bash
#FortiGate Next-Gen Firewall (BYOL)
export STERM="$1"
#6.4.0
export SVERSION="$2"
export REGION="uk-london-1"