The new T4A MosFet Board

Posted on 7th January 2012 in Hardware
 

Some time overdue, but here is the new T4A MosFet Board. Together with the T4A PWM board, it is possible to make your own light or motor control. Controlled from DMX, RF12, IR or whatever you can think of.

The board can be configured for different purposes. It may be used with different Power Mosfets, may contain power convertor to supply a preamp (for use with low voltage control) and a diode may be mounted for controlling inductive loads.

In the most simple application only the MosFet needs to be mounted.

Up to three of these boards may be mounted on the T4A PWM Board.

More on this Board soon.

comments: 0 »

The new T4A PWM Board

Posted on 13th November 2011 in Hardware
 

Since our DMX Processor Board is capable off sending and receiving DMX, lets try to do something with the received DMX data. How about PWM.

Our processor is capable of generating 8bit PWM for up to 4 channels, but uses the processor’s timers to do so. If we need the timers, need more channels or higher resolution we need to look for other ways of generation PWM.

NXP offers a PWM chip PCA9685 that can sink up to 25 mAmps, source 10 mAmps on 16 channels.  It uses 12bits PWM with a programmable frequency from 40Hx to 1000Hz. Even higher freq can be achieved using an external clock.

If we only need 8bits PWM there is the PCA9635. This chip is pin compatible and generates its PWM at a fixed 97.5 kHz.

The newT4A PWM Board offers a small interconnection PCB that has 3 headers with a 3 channel PWM and power supply, one with the rest of the 16 PWM pins, and one I2C interface header that matches the T4A processor boards.

The board will be added to the store shortly.

comments: 0 »

How to program the ATtiny Board using a T4A processor Board

Posted on 10th October 2011 in projects
 

The new ATtiny board can be programmed using an ISP, but if you do not own one, a T4A processor Board can also do the job.
We need to connect the ISP connector on the ATtiny Board to some I/O pins on our processorboard,  load a sketch to emulate a programmer  and off we go.
A modified Arduino boards.txt and programmers.txt file can even make your setup behave as though you where using an Arduino connected via USB !   Hookup the ATtiny84 Board to our T4A processor Board, specify that we are using the ATtiny84 using an arduinoisp as programmer, and you can download your sketches to the ATtiny as is you where using an arduino.

So how do we make this happen ?
Download the ATtiny84 Arduino core files and copy them into your arduino environment.

Add these lines to your board.txt file if they are not already there

 attiny84.name=ATtiny84
 attiny84.upload.protocol=stk500
 attiny84.upload.maximum_size=8192
 attiny84.upload.speed=19200
 attiny84.upload.using=arduinoisp
 attiny84.bootloader.low_fuses=0xe2
 attiny84.bootloader.high_fuses=0xdd
 attiny84.bootloader.extended_fuses=0xff
 attiny84.bootloader.path=attiny84
 attiny84.bootloader.file=fake.hex
 attiny84.bootloader.unlock_bits=0xff
 attiny84.bootloader.lock_bits=0x0fc
 attiny84.build.mcu=attiny84
 attiny84.build.f_cpu=8000000L
 attiny84.build.core=attiny84

Add these line to your programmers.txt file if they are not already there

arduinoisp.name=Arduino as ISP
arduinoisp.communication=serial
arduinoisp.protocol=stk500v1
arduinoisp.speed=19200

Now the Arduino GUI is ready to use our ATtiny84 board.  Restart the GUi and download the ISP-flash sketch onto your T4A processorboard.  Now we only need to hook up the ATtiny..

Since our processorboard run on 3.3Volts, we need to program our target board using 3.3Volts. The easiest way to do this, is to use a JeeConvertor Board. This tiny PCB makes the Arduino pins 4,5,14 and 15, from the expand connector, available as well as provide 3.3V with the onboard regulator.

So we wire an ISP header as follows:

// pin definitions
#define PIN_SCK     14
#define PIN_MISO    4
#define PIN_MOSI    15
#define PIN_RESET   5

The T4A ProcessorBoard has an onboard Graphics display, so why not use it to display status info on the programming process !

So, now we have a Graphical ISProgrammer for our ATtiny84 Board and of course other Atmel processor boards.

 

 

comments: 0 » tags:

Using the ATtiny84 Board

Posted on 27th September 2011 in projects
 

The Core files make it possible for us to access the processor’s pins as if it where an Arduino processor.

There are two ports available:

  1. Port A D3 – D9 (to use D10 you must use these modified corefiles)
  2. Port B D0, D1, D2

When a resonator is used, D0 and D1 cannot be used for these pins are also used to connect the resonator. Port B3 is used as reset-pin.

The Wire library by Donald Blake, modified to support the ATtiny84, uses the processor’s Universal Serial Interface to implement I2C. The SCK/SDA lines are connected to D4 and D6

The processor’s layout looks like this:

// ATMEL ATTINY84 / ARDUINO
//
//                     +-\/-+
//               VCC  1|    |14  GND
//          (D0) PB0  2|    |13  AREF (D10)
//          (D1) PB1  3|    |12  PA1 (D9)
//               PB3  4|    |11  PA2 (D8)
//      PWM (D2) PB2  5|    |10  PA3 (D7)
//      PWM (D3) PA7  6|    |9   PA4 (D6) SCK
// SDA  PWM (D4) PA6  7|    |8   PA5 (D5) PWM
//                     +----+

So say we want to make a tiny slave device that can be accessed via I2C/Wire, as I described in the posts about offloading our processor (part 2 and part 3). For this test we will make a device with only one purpose: output the value send over I2C as PWM output on D5.

The code for this would look like this:

#include "TinyWireS.h"           

#define I2C_SLAVE_ADDR  2    

void setup()
{
  // set Pins
  pinMode(5,OUTPUT);
  analogWrite(5,0);

  // init I2C Slave mode
  TinyWireS.begin(I2C_SLAVE_ADDR);
}

void loop()
{
  if (TinyWireS.available()){
    byte value = TinyWireS.receive();
    analogWrite(5, value);
  }
}

So, now we have a tiny, Arduino GUI programmed, I2C slave that produces PWM.

comments: 0 »

The new ATtiny84 Board

Posted on 25th September 2011 in Hardware, News
 

This board is definitely not an Arduino… but then again…

It surely is small. The ATtiny84 has 8KB ISP flash memory, 512B EEPROM, 512-Byte SRAM, 12 general purpose I/O lines,   2 timers/counters (8-bit/16-bit) with two PWM channels each, internal and external interrupts, 8-channel 10-bit A/D converter, programmable gain stage (1x, 20x) for 12 differential ADC channel pairs, programmable watchdog timer with internal oscillator, internal calibrated oscillator, and four software selectable power saving modes.

Hmmm, interesting… and since there are a number of Arduino Cores available for this little processor, It can even be used from the arduino GUI. I’ve used the SuperCow (R.Wiersma)  Core files with sucess. There even is a I2C/TWI library available or the attiny85 that may be adjusted for this board.

The Board has an ISP connector to program the processor, all pins available on two headers, an onboard LED and a I2C connector.

Optional it may be used with a resonator.

The board is available from the store.

Schematics are freely available

 

 

 

 

comments: 0 » tags: , , ,

To be Arduino or not to be Arduino

Posted on 18th September 2011 in Hardware, News
 

If we compare the T4A processor board to an Arduino Duemilanove we see the following picture

As we notice, the T4A board is somewhat longer. The Arduino on the other hand is somewhat higher.

To be (or not) precise:

  • Arduino 69mm x 54mm (37.26 square cm )
  • T4A 88mm x 36mm (31.68 square cm)

So the T4A board is a little smaller. But then again, the Arduino has an onboard ftdi interface.. where the T4A board needs an external one.

How about the ports?  The Arduino has 13 digital IO-pins and 6 analog ones.

The T4A board has the same, on a slightly different location:

Hmmm, that looks the same. What does the T4A board have more to offer…

  • onboard Rf12b module
  • onboard IR receiver
  • onboard dogm132 Graphics display
  • onboard stepup convertor to feed the whole thing from a single AA cell
  • onboard SDcard slot
  • expand connector that, together with a small convertorboard, allows for connection of many JeePlugs

So, you decide… To Arduino or not to Arduino… That is the question.

 

comments: 0 » tags: , , , ,

The new T4A 4 Channel AudioPlug

Posted on 17th September 2011 in Hardware
 

Here is the new T4A 4 Channel AudioPlug !

Interface compatible with the 2 Channel version, boards may be mixed in any combination.  The board uses the TI PGA4311 and OPA4134. It may be powered from a single ended 5V suppy via the onboard DC/DC convertor, or from the T4A powersuppy board.

The board is available from the store.

DMX control over UDP

Posted on 11th September 2011 in projects
 

So the next step is getting it all together.
Lets try adding a DMXboard to the setup, using a Wire connection to send the commands received over UDP to the DMXboard.

In this case there is only one function we want to access:

void DMXsetChannel(int Channel, byte Value)

We do need a somewhat different message structure because we want to be able to set any of the 512 DMX channels. The UDP message format I used is:

dmx000v000  where the first three zeros contain the DMXchannel
            and the second the DMXchannel's value.

Putting this into code, gives:

  // check msg
  char *ptr = (char *)&(buf[UDP_DATA_P]);
  if (strncmp(ptr, "dmx", 3) == 0) {
      // get data (format: dmx000v000)
      char buff[5];
      memset(buff, 0, 5);

      // get channel
      strncpy (buff, &ptr[3], 3);
      int Channel = atoi(buff);

      // get value
      strncpy (buff, &ptr[7], 3);
      int value = atoi(buff);

      // send to DMX
      DMXsetChannel(Channel, value);
}

The wire communication is also quite simple:

void DMXsetChannel(int Channel, byte Value)
{
  // prepare
  channel.value = Channel;

  // Request
  Wire.beginTransmission(DMX_SERVERADRESS);
  Wire.send(cmdSetDMXChannel);
  Wire.send(channel.byteValue[0]);
  Wire.send(channel.byteValue[1]);
  Wire.send(Value);
  Wire.endTransmission();
}

At the DMXboard side all we need to do, is set call DMXsimple to set the received DMXvalue, and we’re done !

void receiveEvent(int howMany)
{
  // get Packet
  int Cmd = Wire.receive();

  // handle
  switch (Cmd) {
  case cmdSetDMXChannel:
    channel.byteValue[0] = Wire.receive();
    channel.byteValue[1] = Wire.receive();
    value = Wire.receive();
    DmxSimple.write(channel.value, value);
    break;
  }
}

So that’s done ! We can now control our AudioPlug and the DMXboard over UDP using a iPhone app.

The sketches are available from the download page.

comments: 0 » tags: , , , , ,

Using the UDP server to control an AudioPlug

Posted on 10th September 2011 in projects
 

Going from yesterday’s post, it is a small step controlling the T4A AudioPlug.
All we need to do is include the AudioPlug library, initialize the lib withe the correct amount number of boards and analyse the UDP data received.
In my test I programmed Arduinomote to have a slider send the string “vol” followed by the channel number. So for channel 1, we set the string to “vol1″ etc. Arduinomote add a value from 0-255 to this string.
Receiving this values can be done as follows:

  // check msg
  char *ptr = (char *)&(buf[UDP_DATA_P]);
  if (strncmp(ptr, "vol", 3) == 0) {
      // get volume data
      byte Channel = ptr[3] - '0' - 1;
      int volume = atoi(&ptr[4]);

      // send new volume if changed
      if (Plug.getVolume(Channel) != volume) {
          Plug.setVolume(Channel, volume);
          Plug.sendVolumeData();
    }

So now we have a wifi, iPhone controlled AudioPlug !
The complete sketch may be downloaded from the download page.

Remote control with an iPhone

Posted on 9th September 2011 in projects
 

It is alway fun to control something using your telephone.
Ofcouse it is possible to implement a small webserver on our processor board and use our telephone’s browser to access that page, but it is that browser that makes communicating with our device somewhat oversized.

It would be much nicer if we could just send messages to our device.

The underlying ethernet communication TCP/IP and UDP make this possible but the limiting factor here is the telephone…

We need to have a way to send these messages.
Since I’m a iPhone user, I thought: “there must be an app for that”…

And yes! Ardumote (no relation).

It is a simple app that lets you make an interface on your iPhone consisting of buttons, switches and sliders, and have these send UDP messages to your device.
Just what I was looking for.

There was only one catch,  it did not support my enc28j60 based ethercard.
So, work to do…

As I was using the JeeLabs ethercard library,  it turned out that the code to implement an UDP server was there,  but not available.
After exporting the appropriate functions, writing a sketch was not too difficult.

// UDP server Demo
// Adapted from Guido Socher, tuxgraphics.org
// [http://tuxgraphics.org/electronics/200905/embedded-tcp-ip-stack.shtml]
// Theater4all, Frank van den Berg 8-sept-2011 [http://scenelight.nl]
// Using the EtherCard library by jcw [http://jeelabs.org]
#include <EtherCard.h>

static uint8_t mymac[6] = { 0x54,0x55,0x58,0x10,0x00,0x24};
static uint8_t myip[4] = { 192,168,0,222 };
static union {
  uint16_t PortNr;
  uint8_t PortByte[2];
} myport;

#define BUFFER_SIZE 250
static uint8_t buf[BUFFER_SIZE+1];

uint16_t plen;
uint8_t payloadlen=0;
char str[30];

EtherCard eth;

void setup () {
  Serial.begin(57600);
  Serial.print("\n\r[UDP server]\n\r"); 

  // Set port for udp and init ethercard.
  myport.PortNr = 7777;
  eth.spiInit();
  eth.initialize(mymac);
  eth.initIp(mymac, myip, myport.PortNr);
}

void loop () {
  // get the next new packet:
  plen = enc28j60PacketReceive(BUFFER_SIZE, buf);

  // plen will be unequal to zero if there is a valid
  // packet (without crc error)
  if (plen==0) {
    return;
  }

  // arp is broadcast if unknown but a host may also
  // verify the mac address by sending it to
  // a unicast address.
  if (eth_type_is_arp_and_my_ip(buf,plen)) {
    make_arp_answer_from_request(buf);
    return;
  }

  // check if ip packets (icmp or udp) are for us:
  if (eth_type_is_ip_and_my_ip(buf,plen)==0){
    return;
  }

  if (buf[IP_PROTO_P]==IP_PROTO_ICMP_V && buf[ICMP_TYPE_P]==ICMP_TYPE_ECHOREQUEST_V){
    // a ping packet, let's send pong
    make_echo_reply_from_request(buf,plen);
    return;
  }

  // Check port nr
  if (buf[IP_PROTO_P] == IP_PROTO_UDP_V
    && buf[UDP_DST_PORT_H_P] == myport.PortByte[1]
    && buf[UDP_DST_PORT_L_P] == myport.PortByte[0]) {
    // Yes: this one is ours !
    //      handle the package
    payloadlen = buf[UDP_LEN_L_P] - UDP_HEADER_LEN;   
    Serial.println((char *)&(buf[UDP_DATA_P]));

    // If we need to send a reply, this is the place...
    //    strcpy(str, "Got your message");
    //    make_udp_reply_from_request(buf, str, strlen(str), myport.PortNr);
  }
}

Et voila: a working iPhone remote control using UDP messaging.

The changed library with the code from the example can be downloaded here.

comments: 0 » tags: ,