A better, faster, stronger DAC: An R-2R Ladder!

This is amazing. In this video, he simultaneously explains the concept of making Thevenin equivalent circuits (handy!) and shows the (actually pretty simple) mathematics behind this circuit. This method basically allows you to trade many digital pins and many resistors for a single, excellent analog out. B-E-A-utiful.

Planning on using this on an FPGA for an absolutely stupid-ridiculous resolution analog stream. Why not? I’ve got 36 conductor ribbon cable and 108 matched resistors that would be better served as a 36-bit analog out.

That actually might bring me closer to implementing HDMI…naaahh.

nRF24L01+ Module Documentation

nRF24L01+

Library

Arduino Library Download
Copy to ‘Libraries’ folder within your main Arduino folder.

Pins:

MISO -> 12
MOSI -> 11
SCK -> 13

Configurable:

CE -> 8
CSN -> 7

Properties:

byte cePin
CE Pin controls RX / TX, default 8.

byte csnPin
CSN Pin (Chip select not), default 7.

byte channel
RF Channel 0 – 127 or 0 – 84 in the US, default 0.

byte payload
Size in bytes, default 16, max 32.
Note: channel and payload must be the same for all nodes.

Methods:

void init(void)
Initialize the module, set the pin modes for the configurable pins and initialize the SPI module.
Example:
Mirf.csnPin = 9;
Mirf.cePin = 7;
Mirf.init();
void setRADDR(byte *addr)
Set the receiving address. Addresses are 5 bytes long.
Example:
Mirf.setRADDR((byte *)"addr1");
void setTADDR(byte *addr)
Set the sending address.
Example:
Mirf.setTADDR((byte *)"addr1");
void config(void)
Set channel and payload width. Power up in RX mode and flush RX fifo.
Example:
Mirf.payload = 32;
Mirf.channel = 2;
Mirf.config();
bool dataReady(void)
Is there data ready to be received?.
Example:
if(Mirf.dataReady()){
//Get the data to play with.
}
void getData(byte *data)
Get the received data. 'data' should be an array of bytes Mirf.payload long.
Example:
byte data[Mirf.payload]
Mirf.getData(data);
void send(byte *data)
Send data. 'data' should be Mirf.payload bytes long.
bool isSending(void)
Return true if still trying to send. If the chip is still in transmit mode then this method will return the chip to receive mode.
Example:
Mirf.send(data);
while(Mirf.isSending()){
//Wait.
}
//Chip is now in receive mode.
NB: Lots more information is available from the status registers regarding acknowledgement or failure status. See Mirf.cpp:218.
bool rxFifoEmpty(void)
Is the RX Fifo Empty.
bool txFifoEmpty(void)
Is the TX Fifo Empty.
byte getStatus(void)
Return the status register.
void powerUpRx(void)
Power up chip and set to receive mode. Also clear sending interrupts.
void powerUpTx(void)
Power up tx mode.
Exa

Examples

See examples folder in zip file.
Arduino Library Download

Building A Thermostat Using Arduino

This gives an excellent description of the technique. I’ve still yet to determine the switching current, which I’d like to before I build a potentially hazardous item. End goal of this project? Constructing a ‘Nest’-like learning thermostat. Mostly just to predict when I’ll come stomping in from the cold, and adjust the temperature appropriately an hour or two ahead of schedule.

Keeps it toasty.

Teensy (The once and future king) Model 3.0

ImageThis thing is epic embodied. Go ahead and contact Mr. Teensy Himself on Twitter and tell him how appreciative you are. Because it won’t be long before these things are everywhere. With an ARM Cortex-M4 processor and an independent IC for the bootloader, it’s quite resilient to bricking (necessary for me!) native USB, what else is to be expected from PJRC

Oh yeah, and fully working Arduino bootloader and libraries for everyone who doesn’t want to program in C/C++. This is going to be big. Paul claims they easily overclock to 96MHz, and combined with a 32-bit processor, that’s a lot of computing power. Not to mention the 32bit analogWrite() (billions of levels of precision) and 13bit analogRead() (65536 levels of read, or down to a 134uV precision per level. Compare that to a Arduinos’ precision of 19mV, or 4.2mV for the Mega with the 1v1 voltage reference.

So…basically stoked. Get it here for the next day or so.

P.S. Of course, the Kickstarter for this thing was fufilled basically instantly. I mean, we all have the Teensy 2.0, right?

MQ3 (or MQ303a) Alcohol Sensor Arduino Guide

This little device is wonderful, for parties at least. Accuracy wise, it’s not much more than a toy (without some opamps for signal amplification and filtering) but I digress. Just plugged right straight into an Arduino will be plenty of fun, assuming you read the datasheet.


To wire this properly, check out this diagram, which will get further explanation after the break.
Continue reading

IR remote control reverse engineering

If you’re anything like me, or the vast majority of Americans, you are surrounded by IR devices at home, at work, and pretty much everywhere you go. A great number of these devices (round 90%, its kind of the standard) use the 38 kHz SonyIR protocol, but knowing just that doesn’t help much. Especially if you lack a proper oscilloscope, like me. Plus, hell, your remote might be in that mysterious 10 percent. In order to figure out the actual encoding, you need to be able to plot the signals while you fiddle with the remote, and then make a chart relating the independent variable (the fiddling) to the depedent variable, the bursts of 0s and 1s that inevitably ensue.

IR pulses for various button presses on someone else's oscilloscope :-\ man browser up

Trandi has done precisely that, in his reverse engineering a remote controller from a toy chinook to operate his land based Rover and has devised an excellent technique for visualizing the data transmissions from the remote with just an attiny and a IR photodetector IC from radio$hack. Now if you, like me, find your local radio$hack overpriced and understocked, over on the arduino forums its been discovered the same resolution can be had with a plain IR phototransistor and optionally a cheap opamp like the lm741 (or also I hypothesize with a TL082 dual biFET (perhaps wired as a fourth order Butterworth high-pass?) and a IRled. Likely it’d work best reverse biased, reducing the slow response time typical of using an led as a photodiode, at the expense of increased noise. What’s the point? Never had one. And that just burns you up inside!) provided you modify your timings a bit.

A remote much like this one was harmed. Severely.
Continue reading

FM RF Data Link

image

In preparation for testing for my technicians class radio license, I’ve been designing a data modem for my avr chips. The current plan is to use a tuned FM transmitter, driven by an op-amp square wave generator, modulated by a microcontroller. This is an improvement (in both power and computational resources) over the original idea of summing sinewaves on the Tx side and Fast Fournier Transform on the Rx side. Seems pretty wasteful, now doesnt it?

Create a free website or blog at WordPress.com.

%d bloggers like this: