Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

Szymon's Content

There have been 108 items by Szymon (Search limited from 24-May 23)


By content type

See this member's


Sort by                Order  

#1633 Netduino Controlled Servo Robot

Posted by Szymon on 01 September 2010 - 04:32 PM in Project Showcase

Thank you for writing the WiiChuck driver! I was going to take a stab at this, but now I don't have to. AWESOME! Thank you SO much, you have provided so much help to us newbies. :-)


No problem. Now we can be Netduino Ninjas :-)

Let me know how it works out for you or if you have any suggestions how to improve it.



#1313 Native OneWire implementation needed

Posted by Szymon on 26 August 2010 - 08:48 AM in Netduino 2 (and Netduino 1)

Hi, Last couple of days I was trying to write drivers for the DS18B20 one-wire temperature sensor. I converted the code from arduino library found here: http://milesburton.c...Control_Library Since it relies on one-wire protocol I also tried to convert the OneWire arduino library. The latest version is here: http://www.pjrc.com/...bs_OneWire.html Unfortunatelly I couldn't get it to work using managed ports (I used a TristatePort for data pin). I first confirmed my setup is correct by connecting the sensor to Arduino. It works fine there. I think the problem again is the correct timing. I don't have an osciloscope so I can't confirm this, but since one-wire doesn't even use a clock pin it has to rely on tight timings. As explained on http://en.wikipedia.org/wiki/1-Wire to transmit logical "0" master needs to send short 1-15 µs pulse. To send "1" the pulse should be 60 µs. The arduino code implements direct write through registers and microsecond delays. I don't think we can achieve this timing accuracy in managed code as was already observed by Pavel Bánský http://bansky.net/bl...k/comments.html However guys from GHI have included one-wire support in their firmware. So I run the same code for the temperature sensor on FEZ Mini board (but using their OneWire library instead) and this time it works perfectly. Chris Seto implemented it on FEZ a while ago as well http://files.chrisseto.com/8DC So I'm afraid that to interface with this type of devices we would need native support in the netduino firmware. It doesn't look very complex so I hope it could be added quickly. EDIT: I submited change proposal to the .NET MF team http://www.netmf.com...bf-3e8d70abfffb



#1321 Native OneWire implementation needed

Posted by Szymon on 26 August 2010 - 10:38 AM in Netduino 2 (and Netduino 1)

Thats great news! Let me know if I can help with testing or anything.



#1314 Native OneWire implementation needed

Posted by Szymon on 26 August 2010 - 09:08 AM in Netduino 2 (and Netduino 1)

Here is my delay microseconds method:

        private const long TicksPerMicrosecond = TimeSpan.TicksPerMillisecond/1000;

        private static void DelayMicroseconds(int microSeconds)
        {
            long stopTicks = Utility.GetMachineTime().Ticks + 
                (microSeconds * TicksPerMicrosecond);

            while (Utility.GetMachineTime().Ticks < stopTicks) { }
        }



#1637 Motor Control in an Airsoft gun

Posted by Szymon on 01 September 2010 - 06:45 PM in General Discussion

Hi Stacy, Recenty there was a series of posts on the Make Blog about using Arduino to control aNerf Sentry Gun. Maybe this will give you some ideas to start with: Here are few of the posts in this series: http://blog.makezine...uild_wirin.html http://blog.makezine...emassembly.html http://blog.makezine...uild_prima.html http://blog.makezine...denclosure.html http://blog.makezine...king_stand.html http://blog.makezine...uild_motor.html They apparently used relays for this project: http://blog.makezine...olderrelay.html



#1050 More blinking leds

Posted by Szymon on 22 August 2010 - 02:30 PM in Project Showcase

Do you know the part/model # or where I could buy one? It's nice!


It's just regular potentiomater that I got from a local hobby electronics store in my town.
Looks exactly like this one: http://www.oreind.co...products_id=859

I only put a platics knob on it :-)



#1044 More blinking leds

Posted by Szymon on 22 August 2010 - 02:10 PM in Project Showcase


What potentiometer are you using?


10K



#1412 More blinking leds

Posted by Szymon on 27 August 2010 - 11:23 AM in Project Showcase

Ok, think this should be stickied, the problem is that VS2010 will AUTOMATICALLY put the microsoft default PINS in there, which do not map up to the Netduino pins. That was my problem. Thank you so much!!!!


I think you are right. The classes from SecretLabs.NETMF.Hardware.Netduino namespace should be actually declared as internal classes on Netduino class. Then it would be clear that you have to write for example Netduino.Pins.GPIO_PIN_D3. Currently this code is invalid. If I remmember ut is done this way in GHI and DeviceSolutions SDKs.



#1032 More blinking leds

Posted by Szymon on 22 August 2010 - 09:41 AM in Project Showcase

Hi, I have published article on my blog that shows how to use shift registers to extend number of digital output pins on Netduino. In particular I demonstrate how to use it to control a 7-segment display or any other LED components. In two examples I show how to display values from potentiometer and SHT15 temperatuer & humidity sensor. Here is the blog post: http://geekswithblog...nking_leds.aspx I also made a short video to show how this works: You can download the source code here: http://cid-4c7ec0c21...s^_20100822.zip Please let me know if you like it or not, and if you would like to see more projects like this from me.



#1323 More blinking leds

Posted by Szymon on 26 August 2010 - 11:29 AM in Project Showcase

Here is a simple Shifter test class extracted from my project:

using System;
using System.Threading;
using Microsoft.SPOT.Hardware;

namespace ShiftRegisterTest
{
    public class Program
    {
        private static Cpu.Pin latchPin     = SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D7;
        private static Cpu.Pin clockPin     = SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D6;
        private static Cpu.Pin dataPin      = SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D5;

        public static void Main()
        {
            var shifter = new Shifter(latchPin, clockPin, dataPin);

            byte value = 0;
            while (true)
            {
/*
                // blink all LEDs
                shifter.Write(255);
                Thread.Sleep(200);
                shifter.Write(0);
                Thread.Sleep(200);
*/
                // blink single LED
                shifter.Write(value);
                value = (byte)(value << 1);
                if (value == 0) value = 1;
                Thread.Sleep(200);
            }
        }
    }

    public class Shifter : IDisposable
    {
        private readonly OutputPort _latchPort;
        private readonly OutputPort _clockPort;
        private readonly OutputPort _dataPort;

        public Shifter(Cpu.Pin latchPin, Cpu.Pin clockPin, Cpu.Pin dataPin)
        {
            _latchPort = new OutputPort(latchPin, false);
            _clockPort = new OutputPort(clockPin, false);
            _dataPort = new OutputPort(dataPin, false);
        }

        public void Dispose()
        {
            _latchPort.Dispose();
            _clockPort.Dispose();
            _dataPort.Dispose();
        }

        public void Write(params byte[] buffer)
        {
            // Ground latchPin and hold low for as long as you are transmitting
            _latchPort.Write(false);

            for (int i = 0; i < buffer.Length; i++)
            {
                ShiftOut(buffer[i]);
            }

            // Return the latch pin high to signal chip that it 
            // no longer needs to listen for information
            _latchPort.Write(true);
            _latchPort.Write(false);
        }

        private void ShiftOut(byte value)
        {
            _clockPort.Write(false);

            for (int i = 0; i < 8; i++)
            {
                byte mask = (byte)(1 << i);
                _dataPort.Write((value & mask) != 0);

                // Raise Clock
                _clockPort.Write(true);

                // Raise Data to prevent IO conflict 
                _dataPort.Write(true);

                // Lower Clock
                _clockPort.Write(false);
            }
        }
    }
}




#1322 More blinking leds

Posted by Szymon on 26 August 2010 - 11:05 AM in Project Showcase

I'm using Dig Pin5 for DS, Dig Pin6 as Data, Pin7 as latch and reading values from Q0 on Pin0 and Q1 on Pin1.


You should be using the SecretLabs.NETMF.Hardware.Netduino.Pins enumeration instead of Cpu.Pin. This will ensure correct mapping from hardware specific pin numbers to internal numbers. For example Netduino.Pins.GPIO_PIN_D5 true value is 51. So in your case you should change these lines:

            OutputPort DS = new OutputPort(SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D5, false); 
            OutputPort StoreData = new OutputPort(SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D6, false); 
            OutputPort Latch = new OutputPort(SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D7, true); 
 
            InputPort Read1 = new InputPort(SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D0, false, Port.ResistorMode.Disabled); 
            InputPort Read2 = new InputPort(SecretLabs.NETMF.Hardware.Netduino.Pins.GPIO_PIN_D1, false, Port.ResistorMode.Disabled); 

I hope this helps.



#3127 Memory considerations

Posted by Szymon on 28 September 2010 - 06:16 PM in Netduino Plus 2 (and Netduino Plus 1)

Hi,
I'm working on a larger project for Netduino Plus. I was hoping to use System.Http.dll but it turns out that I'm running out of memory when I try to deploy the whole project. So I started looking how the memory is allocated.

First here are the assemblies that are included wiht the Netduino Plus firmware:
mscorlib (4.1.2821.0) (3880 RAM - 33236 ROM - 19134 METADATA)
Microsoft.SPOT.Native (4.1.2821.0) (1144 RAM - 6516 ROM - 4479 METADATA)
Microsoft.SPOT.Hardware (4.1.2821.0) (1752 RAM - 11440 ROM - 7371 METADATA)
Microsoft.SPOT.Net (4.1.2821.0) (704 RAM - 5060 ROM - 2452 METADATA)
System (4.1.2821.0) (872 RAM - 5992 ROM - 3206 METADATA
Microsoft.SPOT.IO (4.1.2821.0) (740 RAM - 4620 ROM - 2522 METADATA)
System.IO (4.1.2821.0) (1548 RAM - 13292 ROM - 5862 METADATA)
Microsoft.SPOT.Hardware.SerialPort (4.1.2821.0) (508 RAM - 3440 ROM - 1527 METADATA)
Microsoft.SPOT.Hardware.Usb (4.1.2821.0) (580 RAM - 3740 ROM - 1844 METADATA)
SecretLabs.NETMF.Hardware (4.1.0.0) (256 RAM - 1108 ROM - 491 METADATA)
Total: (10320 RAM - 88444 ROM - 48888 METADATA)

As you can see in total it consumes about 88KB of RAM and I think most of these libraries are essential for any project. Well maybe apart from Microsoft.SPOT.Hardware.Usb - I guess most of network devices won't need ot connect as USB client. But it gains us only about 4KB.

When I add System.Http to blank project I can deploy it but it leaves very little ROM left. Here are the additional assemblies:
Microsoft.SPOT.Net.Security (4.1.2821.0) (264 RAM - 1220 ROM - 606 METADATA)
System.Net.Security (4.1.2821.0) (664 RAM - 4544 ROM - 1943 METADATA)
System.Http (4.1.2821.0) (2976 RAM - 38160 ROM - 12831 METADATA)

So in total it will add almost 44KB ROM. Of this about 6KB is used for the security assemblies. I guess this is requried to support HTTPS. I don't need it for my project at the moment so it would be cool to turn it off. (Again, I wish .NET MF had a post compile linker like MonoTouch to strip the code that is not executed in the project).

According to the tech spec Netduino Plus has only 48KB ROM left for our code. So with System.Http it leaves us with only about 4KB. It's really not enough for anything beyond a most basic project. For example for my project I estimate at least 15KB be needed.

So for now System.Http is no go, and I will try to implement basic HTTP functions on my own. But I hope there is a way to reduce the size of these libraries somehow so we get at least 15-20KB ROM more.



#3173 Memory considerations

Posted by Szymon on 29 September 2010 - 05:48 AM in Netduino Plus 2 (and Netduino Plus 1)

Hi Syzmon,

Building off what Chris said, you might want to compile your own HTTP library. I highly suggest you use code from the .NET MF Toolkit (http://mftoolkit.codeplex.com/). Michael Schwarz is the creator of that project. The .NET MF Toolkit contains a library for HTTP. Download the latest changeset from the source code, change the project references from .NET MF 3.0 to version .NET MF 4.1, and lastly compile. You will be using the dll's built from the MicroHttp project.

You can easily remove classes and what not from the project that you won't use to reduce the amount of space the assemblies take up.


Hi,
I already started triming down the MicroHTTP project. Initially it consumed 37KB because it also used the security libraries, but after commenting out SSL support and removing few other classes I got it down to 26K.

However this implementation is targeting scenario where .NET MF device acts as HTTP server (accept requests and sends responses). For current project I need it to act as a client and connect to remote HTTP server. So I was planing to add these functions to the library.

Chris mentionsed another way - to take the existing System.Http.dll appart and try to trim it down (I forgot it has Appache license and we can do this). If I can get it down to 30KB it should be fine.

-Szymon



#254 Libraries, Drivers and Shields

Posted by Szymon on 11 August 2010 - 05:57 PM in Netduino 2 (and Netduino 1)

I think one of the strengths of Arduino is the Playground area at http://www.arduino.cc/playground/ and especially the pages that collect information (including links to any libraries) about interfacing with various hardware: http://www.arduino.c...ingWithHardware Do you plan to add similar Wiki on this site? There are already some good libraries for .NET MF but its hard to find them on the web. It would be cool to have a single source for such information.



#2426 LCD Library

Posted by Szymon on 18 September 2010 - 04:03 PM in Project Showcase

Hi, The pin assignment looks exactly the same as one that I used. If you look at the diagram on my blog the pins on the LCD are numbered from right to left. Thus as you can see pin 3 is connected to potentiometer to adjust the display contrast. I use output pin 0 on shift register to turn backlight on or off so it should be reserved. Then pins 1,2,3 on shift register are connected to pins 4,5,6 on the display (rs, rw, enable). Finally pins 4 through 7 are connected to pins 11 to 14 on display. Because it uses 4-bit mode display pins 7 to 10 are not connected. I hope this helps. -Szymon



#1780 LCD Library

Posted by Szymon on 05 September 2010 - 06:20 PM in Project Showcase

Hi, In my third blog post I'm demonstrating how to connect an alpahnumeric 16x2 LCD display to the Netudino. I created a library based on Arduino LiquidCrystal lib and earlier work done by Pavel Bansky. The LCD can be connected both directly (in 4-bit and 8-bit modes) or via a 74HC595 shift register. Here is the blog post: http://geekswithblog...id_crystal.aspx The source code is here: http://cid-4c7ec0c21...l^_20100905.zip



#1886 LCD Library

Posted by Szymon on 07 September 2010 - 06:05 AM in Project Showcase

I'm glad that some of you found my library useful, and posted about your results: http://forums.netdui...-seeeduino-lcd/ I was thinking to put it on CodePlex so that we can keep a better track of all code changes and extensions. What do you think? Should I keep the name MicroLiquidCrystal for the project?



#2584 LCD Library

Posted by Szymon on 21 September 2010 - 08:21 PM in Project Showcase

Hi, I have finally published the library on CodePlex. You can grab it here http://microliquidcr...l.codeplex.com/ Basically the same code as previously published on my blog, just with few renames. Please let me know if you have any suggestions on what can be improved.



#1783 LCD Library

Posted by Szymon on 05 September 2010 - 07:46 PM in Project Showcase

Or just cheat and get a SerLCD from Sparkfun. ;-)


Meh, that would be no fun. Besides I didn't wanted to wait for the order ;-)



#3776 LCD Library

Posted by Szymon on 11 October 2010 - 07:06 PM in Project Showcase

Hi all, Sorry for delayed response. I'm finally back home and could take close photos of my board for anyone who wants to take a look. My board is mounted with components facing the LCD thus I had to reverse the order of pins on the shift register. This is why I added the MSB/LSB option to the provider. In my case I use a 10K pot to adjust the contrast and backlight is turned on/off via the one remaining output of shift register.

Attached Thumbnails

  • _MG_2269.jpg
  • _MG_2273.jpg



#3777 LCD Library

Posted by Szymon on 11 October 2010 - 07:09 PM in Project Showcase

This stuff is hard to debug if you get it wrong :)


What I did to verify it works correctly, was simply put LEDs to each output of the shift register instead of connecting it to LCD. Then I could step through the code and observe if they are light up in correct pattern. I think the backlight would be easiest to verify. Just make a loop to turn it on/off and see if the apropriate LED will blink.



#3779 LCD Library

Posted by Szymon on 11 October 2010 - 07:13 PM in Project Showcase


Secondly the Fritzing wiring diagram on Szymon's blog page is slightly incorrect w.r.t. the SPI port:

SHCP = PIN 13 (not 12)
STCP = PIN 10
DS = PIN 11


Thanks for spoting this. In earlier version I sent data to shift register all in managed code, but later I switched to hardware SPI and thus had to move clock input pin to SPCK (pin 13).

Edit: I have updated the diagram in the blog post.



#3843 LCD Library

Posted by Szymon on 13 October 2010 - 03:02 PM in Project Showcase

Edit: The strange things appearing seems to be intermittent, it happened when I first turned it on this morning. Here is a picture...


Spike,
Looking at the photo I can't see exactly how you connected wires to the LCD. Did you solder them directly or added header pins?

In any case make sure they are connected firmly. If any of the wires gets disconnected the LCD can't interpret the commands and thus you might get the garbage flickering on screen as you are seeing now.



#5252 LCD Library

Posted by Szymon on 24 November 2010 - 06:27 PM in Project Showcase

I have updated the LCD library to support I2C port expanders. In particular this enables to use the library with the Adafruit's i2c/spi LCD backpack: http://www.adafruit....products_id=292 http://www.ladyada.n...spilcdbackpack/ Of course it already supported the SPI mode but now you can choose I2C as well (however I found that I2C is 2-3 times slower than SPI). Please see new example project HelloWorld_I2C for demonstration on how to use the new provider. This release also incorporates the ShifterSetup as sugested by sweetlilmre in this thread. This enables anyone to configure mapping of the shifter outputs to LCD pins. You can pass your setup via optional parameter to shifter constructors.



#295 LCD interface

Posted by Szymon on 12 August 2010 - 08:37 AM in Netduino 2 (and Netduino 1)

I'm going to try to fit Netduino in Adafruit's Arduino Enclosure http://www.adafruit....products_id=271 I think it would fit nicely and only need to do one more cut out for micro USB. And I plan to add LCD display and buttons for debugging of my device.




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.