5/25/2014

UIPEthernet EchoServer example and test


Below example code. from UIPEthernet library.



/*
 * UIPEthernet EchoServer example.
 *
 * UIPEthernet is a TCP/IP stack that can be used with a enc28j60 based
 * Ethernet-shield.
 *
 * UIPEthernet uses the fine uIP stack by Adam Dunkels <adam@sics.se>
 *
 *      -----------------
 *
 * This Hello World example sets up a server at 192.168.1.6 on port 1000.
 * Telnet here to access the service.  The uIP stack will also respond to
 * pings to test if you have successfully established a TCP connection to
 * the Arduino.
 *
 * This example was based upon uIP hello-world by Adam Dunkels <adam@sics.se>
 * Ported to the Arduino IDE by Adam Nielsen <malvineous@shikadi.net>
 * Adaption to Enc28J60 by Norbert Truchsess <norbert.truchsess@t-online.de>
 */

#include
// The connection_data struct needs to be defined in an external file.
#include
#include


EthernetServer server = EthernetServer(1000);

void setup()
{
  Serial.begin(9600);
  uint8_t mac[6] = {0x00,0x01,0x02,0x03,0x04,0x05};
  IPAddress myIP(192,168,1,177);
  Ethernet.begin(mac,myIP);
  server.begin();
}
void loop()
{
  size_t size;
  if (EthernetClient client = server.available())
    {
      if (client)
        {
          while((size = client.available()) > 0)
            {
              uint8_t* msg = (uint8_t*)malloc(size);
              size = client.read(msg,size);
              Serial.write(msg,size);
              client.write(msg,size);
              free(msg);
            }
        }
    }
}


Testing.

$ telnet 192.168.1.177 1000
Trying 192.168.1.177...
Connected to 192.168.1.177.
Escape character is '^]'.

( typing keyboard ... for test )



5/24/2014

Arduino pro mini 3.3v 8MHz or 5V 16 MHz - ENC28J60 SPI wire pin map.



ENC28J60 SPI

Arduino pro mini 3.3v - VCC no ohm.

Arduino pro mini 5v = VCC 10 ohm 



Mini Ethernet Module Arduino Pro Mini
GND GND
3.3V 3.3V ( 250 mA, VDD = 3.45V, FCLK =10 MHz, SO = open )  
RESET not connected  - or connect.
CLKOUT not connected
INT PIN 3
W0L not connected
S0 PIN 12
SI PIN 11
SCK PIN 13
CS PIN 8 or PIN 10    
--- ---

5/20/2014

Ubuntu, Raspberry Pi,CubieBoard Linux A2DP, bluetooth audio source receiver service, speaker


Bluetooth A2DP receiver.

$ sudo apt-get install pulseaudio-module-bluetooth
$ pactl load-module module-loopback source_dont_move=yes source=$BTSOURCE sink=$SINK
  • You can find $SINK with $ pactl list sinks, $SINK is shown after Name:
  • And you can see the $BTSOURCE with $ pactl list sources
$ pactl load-module module-loopback source_dont_move=yes source=bluez_source.9C_E6_E7_C8_B2_A3 sink=alsa_output.platform-bcm2835_AUD0.0.analog-stereo
ex) Play audio from Smartphone 

Find pulseaudio source list
 $ pactl list sources
Source #0
        State: IDLE
        Name: alsa_output.platform-bcm2835_AUD0.0.analog-stereo.monitor
        Description: Monitor of bcm2835 ALSA Analog Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 4
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor of Sink: alsa_output.platform-bcm2835_AUD0.0.analog-stereo
        Latency: 0 usec, configured 371519 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Monitor of bcm2835 ALSA Analog Stereo"
                device.class = "monitor"
                alsa.card = "0"
                alsa.card_name = "bcm2835 ALSA"
                alsa.long_card_name = "bcm2835 ALSA"
                alsa.driver_name = "snd_bcm2835"
                device.bus_path = "platform-bcm2835_AUD0.0"
                sysfs.path = "/devices/platform/bcm2835_AUD0.0/sound/card0"
                device.string = "0"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card"
        Formats:
                pcm

Source #2
        State: RUNNING
        Name: bluez_source.9C_E6_E7_C8_B2_A3
        Description: SHW-M440S
        Driver: module-bluetooth-device.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 25
        Mute: no
        Volume: 0: 100% 1: 100%
                0: 0.00 dB 1: 0.00 dB
                balance 0.00
        Base Volume: 100%
                     0.00 dB
        Monitor of Sink: n/a
        Latency: 198393 usec, configured 193344 usec
        Flags: HARDWARE DECIBEL_VOLUME LATENCY 
        Properties:
                bluetooth.protocol = "a2dp_source"
                device.description = "SHW-M440S"
                device.string = "9C:E6:E7:C8:B2:A3"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                bluez.path = "/org/bluez/2163/hci0/dev_9C_E6_E7_C8_B2_A3"
                bluez.class = "0x5a020c"
                bluez.name = "SHW-M440S"
                device.icon_name = "audio-card-bluetooth"
        Formats:
                pcm

Arduino pro mini 5v 3.3 v - bootloader, write AVR MKII



Arduino pro mini bootloader write AVR MKII

- Avr Studio 4.18

- Attached avr mkii on Win7 64.

AVR MKII driver install.  ( not libusb driver )


 Your Installed Dir Arduino Sketch \
                            Arduino\
                            arduino-1.5.6-r2-windows\
                            arduino-1.5.6-r2\
                            hardware\
                            arduino\
                            avr\
                            bootloaders


Boot Loader Hex file Pro mini 5V/16MHz

reference from boards.txt ( arduino-1.5.6-r2-windows\arduino-1.5.6-r2\hardware\arduino\avr )

pro.menu.cpu.16MHzatmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex




5/18/2014

OV7670 Pin Map

OV7670 CAMERA 

Arduino ov7670 reference.

http://www.arducam.com/download/

16 pin module.
http://emartee.com/product/41908/

20 pin ? other module.

http://forum.arduino.cc/index.php?PHPSESSID=ltg6b5m1pr6qs956c93k66qc42&topic=159557.0
https://gist.github.com/youngsoonpark/ed893de73026a450b99f
DescriptionNameOV7670 pin
VCC+V1
GroundGND2
SCCB CLKSCL3
SCCB DataSDA4
Vertical synchronizationVSYNC5
Line synchronizationHREF6
FIFO Write EnableWEN7
XCKXCK8
FIFO read address resetRRST9
FIFO chip enableOE10
FIFO read clockRCLK11
GroundGND12
FIFO output dataD013
FIFO output dataD114
FIFO output dataD215
FIFO output dataD316
FIFO output dataD417
FIFO output dataD518
FIFO output dataD619
FIFO output dataD720