Skip to content

Instantly share code, notes, and snippets.

/* Melbus CDCHGR Emulator
* Program that emulates the MELBUS communication from a CD-changer (CD-CHGR) in a Volvo V70 (HU-xxxx) to enable AUX-input through the 8-pin DIN-contact.
* This setup is using an Arduino Nano 5v clone
*
* The HU enables the CD-CHGR in its source-menue after a successful initialization procedure is accomplished.
* The HU will remove the CD-CHGR everytime the car starts if it wont get an response from CD-CHGR (second init-procedure).
*
* Karl Hagström 2015-11-04
* mod by S. Zeller 2016-03-14
*
@klalle
klalle / Melbus_CDCHGR_Emulator.ino
Last active June 5, 2021 22:10
AUX Hack on Volvo HU-xxxx
/* Melbus CDCHGR Emulator
* Program that emulates the MELBUS communication from a CD-changer (CD-CHGR) in a Volvo V70 (HU-xxxx) to enable AUX-input through the 8-pin DIN-contact.
* Tis setup is using an Arduino Nano 5v clone
*
* The HU enables the CD-CHGR in its source-menue after a successful initialization procedure is accomplished.
* The HU will remove the CD-CHGR everytime the car starts if it wont get an response from CD-CHGR (second init-procedure).
*
* Karl Hagström 2015-11-04
*
* This project went realy smooth thanks to these sources:
@klalle
klalle / EnergyMeter.pde
Created January 7, 2015 19:41
EnergyMeter-Processing
import processing.serial.*;
Serial myPort; // Create object from Serial class
String val; // Data received from the serial port
//print to csv-file
PrintWriter output;
long xPos = 1; // horizontal position of the graph
//int xLast[] = new int[6];
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h" //Activate for NRF-debug (printf_begin(); in setup() followed by radio.printDetails();)
#define CE_PIN 9
#define CSN_PIN 10
//
// Hardware configuration
/*
Reads voltage and power from China-style energy meter and sends it to nRF24L01+.
Collecting data from meter by eavesdropping on the MOSI-line (master in slave out)
between the energy monitoring chip (ECH1560) and the main processor
Meter Arduino
GND (Brown) GND (2nd from the end of the meter-board)
VCC (3.6V) RAW (Connect to battery "+" under meter-board)
CLK (Green) D2 (INT0) (5th from the end of the meter-board)
SDO (Blue-white) D5 (6th from the end of the meter-board)
@klalle
klalle / EnergyMeter.ino
Last active March 28, 2020 00:13
EnergyMeter
/*
Reads voltage and power from China-style energy meter.
Collecting data by eavesdropping on the MOSI-line (master in slave out)
between the energy monitoring chip (ECH1560) and the main processor*/
const int CLKPin = 2; // Pin connected to CLK (D2 & INT0)
const int MISOPin = 5; // Pin connected to MISO (D5)
//All variables that is changed in the interrupt function must be volatile to make sure changes are saved.
volatile int Ba = 0; //Store MISO-byte 1
import socket
import threading
import socketserver
import time
import nRF24L01p
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
"""Thread class"""
def handle(self):
while 1:
@klalle
klalle / nRF24L01p.py
Last active December 17, 2015 19:09
#!/usr/bin/env python3
from quick2wire.spi import *
from quick2wire.gpio import Pin
from quick2wire.gpio import In,Out,pi_header_1
import time
import TCP_Server
PAYLOAD_SIZE = 3
SMALL_PAUSE = 0.05
@klalle
klalle / nRF2401_Transmitter.c
Last active October 12, 2022 11:30
This is a simple code that waits for the USART interrupt, that receives the payload from the USART and then calls the send-function to broadcast the data to listening nRFs.
/*
* RF_Tranceiver.c
*
* Created: 2012-08-10 15:24:35
* Author: Kalle
* Atmega88
*/
#include <avr/io.h>
#include <stdio.h>