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.

Zoot's Content

There have been 19 items by Zoot (Search limited from 24-April 23)


By content type

See this member's

Sort by                Order  

#61121 5V sensor with netduino 2

Posted by Zoot on 02 January 2015 - 02:49 AM in General Discussion

Don't think of it as losing 2V.  You aren't really losing any of the span and accuracy of the sensor output signal, you're just scaling it into a voltage that the Netduino can understand and work with.  It pretty common to do this in the analog to digital world, where some of the analog voltages are outside the range at which ADC chips can work.  The input signals have to be adjusted for the ADC chip to use them.  That's exactly what is happening here.  5V becomes 3V, and 0V is still 0V.  You're taking the output range and compressing it slightly, but you still have all of the range represented in the 0 - 3V span of the signal.

 

You'll have to do some translation tricks in the code, like using a correction factor to arrive at the actual value represented by the new voltage, but that can be arrived easily enough by using the ratio of voltages.  In this case 3V/5V = a 0.6 correction factor.  If, in a 5V span, the sensor puts out 3.3V, the new circuit would display that 3.3V signal as 3.3 * 0.6 = 1.98V.  You just have to interpret that in your code the right way.  So if your sensor is saying that it is at 10 PSI when putting out 3.3V, your Netduino will read that same 10 PSI pressure reading at approximately 2V, you just have to teach your Netduino code to understand what that means.

 

To obtain your correction factor, take 5V and apply it to the top of the voltage divider with the divider connected to the Netduino pin.  Measure the voltage on the resistor leg at the Netduino pin.  Take that voltage and divide it by 5 Volts.  Presto, you now have a scaling, or correction factor to use in your code.  To scale downward, multiply by the correction factor.  To scale upward, multiply by the inverse of the correction factor (1/correction factor).




#61116 5V sensor with netduino 2

Posted by Zoot on 01 January 2015 - 04:11 PM in General Discussion

You want higher value resistors to limit the current into the Netduino.  Make Z1 10000 Ohms.  Also, make ZL 50000 Ohms to reflect the input resistance of the Netduino.  That will give you a more accurate voltage when hooked up.  Don't forget to test the voltage before hooking it up to the Netduino.

 

You also might want to choose a value for Z2 that provides 3V rather than 3.3V.  3.3V is the maximum for the analog port.  I prefer to use a little less voltage than the maximum for safety reasons.




#61111 5V sensor with netduino 2

Posted by Zoot on 01 January 2015 - 03:18 AM in General Discussion

A voltage divider is the way to go on this one.  Here's a link to the theory behind the voltage divider and a handy calculator:

 

http://hyperphysics....ric/voldiv.html

 

Also, this is a pretty good voltage divider calculator:

 

http://www.sengpiela...tagedivider.htm

 

Use calculator # 2.

 

 

According to the datasheet, the input resistance of the ADC is maximum 50k Ohms (If I read it right) so that would have to be taken into account for your measurements to be accurate.  The input resistance would be represented in a voltage divider as RL.

 

You can mess around with the calculator on that page and try different values.  Best to do your calculations to get 3V or 3.3V as an open circuit voltage and hook it to the Netduino.  The voltage will then drop to around the value given for the loaded voltage.  You can then adjust the voltages as necessary.  Remember to disconnect the voltage divider from the Netduino when changing out resistors.  You don't want to brick your analog port.




#61085 Creating a COM port for serial communication with Netduino GO!

Posted by Zoot on 27 December 2014 - 06:20 PM in General Discussion

You need a USB to TTL converter to create a a serial port on the PC which can then be connected to the serial ports on the Netduino Go (I'm assuming that you are using the COM ports on the Shieldbase).  These are been based on FTDI or equivalent chips.

 

Some things to be aware of:

  1. Netduino COM ports work on 0-3.3V logic levels.  These are different from classic COM ports on PCs which use upto +/-15V to represent 0 & 1
  2. The COM on the Shieldbase should be 5V tolerant for incoming signals but will only be able to output 3.3V for logic 1.

Hope this helps,

Mark

Thank you Mark, that is what I was trying to say but failed miserably, lol.

 

I knew I was forgetting something.




#61080 Creating a COM port for serial communication with Netduino GO!

Posted by Zoot on 26 December 2014 - 11:52 PM in General Discussion

Yes.  I'm referring to a USB to 9 pin serial cable adapter.  It allows your USB port to function as a serial COM port with an assignable (usually) COM port number.  It behaves just as though you have a serial port on your laptop, and allows you to talk to a serial port implemented on a Netduino or other hardware (PIC, Arduino, anything with a hardware serial port and internal UART).

 

The problem that you're running into is that (to my knowledge, and someone please correct me if I'm wrong), the USB port on the Netduino cannot be used for serial communication in it's native form.  You would have to write a library to allow the USB port to function as a serial device.  It could be done, (I think), but it would knock out the debugging functions of the Netduino, as it can't function as a USB device and a serial device at the same time.  I can't verify this at the moment, as I can't find the code I was looking for on my PC, so I could be entirely wrong about this.

 

The TI and Stellaris boards may have had a serial monitor implemented in their firmware which allowed you to connect with Putty through USB, but to my knowledge, the Netduino does not allow this.  I currently have a Netduino attached to my PC spitting out a serial stream, and I can't connect to the stream with Putty.  Also, I don't have a serial port in Device Manager to connect to.  The only way that I was able to connect to the serial stream was to use my USB to serial converter.




#61076 Creating a COM port for serial communication with Netduino GO!

Posted by Zoot on 26 December 2014 - 06:07 PM in General Discussion

Hi Dave,

 

If you have no COM ports in your laptop, you'll have to use something like a USB to serial adapter to provide a COM port that can talk to the Netduino.  Once you have the COM port set up, it's a matter of connecting it to the Netduino, and selecting the proper port on the laptop.  Putty should then work fine.

 

Note that you don't have to change the COM port on the Netduino.  COM 1 is fine for it.  A USB to serial adapter on your laptop will probably show up as COM 3 or COM 4, but there is not a requirement to have the Netduino port be the same number as the PC's port.  They are two separate entities and the port numbers won't usually correspond with each other.  The Netduino's port will be invisible to the PC, all you will see is the USB to serial adapter's port, and when the two are connected, you should have communication if the parameters are right, but you won't actually "see" the Netduino in Device Manager.

 

I hope that made some sense.  Post back if anything is unclear.




#60964 How to push game controller buttons?

Posted by Zoot on 13 December 2014 - 05:22 PM in General Discussion

I drew up a little circuit to explain what I meant in the previous post.  It's how to implement a Netduino button pusher:

 

Button Capture.PNG

 
I'm assuming that the button on the controller closes to ground when pushed.  The ground of the Netduino circuit and the ground on the controller must be tied together for this to work.  The output pin of the Netduino goes into the base of transistor Q1 via a 4.7k resistor, and the transistor's output (the collector) is pulled to 3.3V or 5V (depending on the supply) by the 10k resistor.  The 10k resistor may not be needed if the active side of the button is already pulled up to the supply voltage on the controller.  In that case just omit it.
 
The circuit works by setting the Netduino pin to a high level, or "1".  This makes the transistor conduct causing the output of the transistor to connect to ground, activating the controller's button circuit as though you had pressed the button.  The connection to the active side of the button needs to be soldered to the button pad.
 
You would need a circuit like this for every button that you wanted to activate on the controller, and probably a shift register to handle all of the outputs.  That way, you can use a minimal amount of pins on the Netduino to run the circuit, and drive many buttons at the same time.
 
Hope this helps.



#60961 DTMF with netduino plus 2

Posted by Zoot on 13 December 2014 - 04:44 PM in Project Showcase

I would use a DTMF decoder chip like the MT8870 or the chip that Matt suggested and have it talk to the Netduino.  Much easier than trying to decode it with the 'duino.




#60960 How to push game controller buttons?

Posted by Zoot on 13 December 2014 - 04:34 PM in General Discussion

To use relays, the circuitry would be quite complicated in order to protect the netduino from damage, though it could be done, it's probably overkill for what you're trying to do.  Not to mention costly.  Relays can be expensive.

 

Most of those types of controller buttons work by closing a circuit to ground.  If you look at the pads on the board where the buttons are, you can see they are split in half.  One side is usually ground, the other side is what's called the "active" side.  The circuit is activated (or the button "pushed") by connecting the two pads together.  This type of circuit can be fooled by providing a logic signal to the active side using the netduino and a transistor to connect the active side to the logic level required, most likely ground.

 

It's an ambitious project, and connecting four controllers would likely take a 74HC595 shift register or two to provide the necessary outputs to control all four controllers.  I'll see if I can whip together a circuit that explains how to drive the buttons.  Stay tuned.




#60959 PS2 Keyboard scancodes output

Posted by Zoot on 13 December 2014 - 04:20 PM in General Discussion

A Netduino 1 might be a little small for the task. memory wise, but you could have some digital outputs interfaced to a PS2 connector, and have whatever binary input you like with remaining pins.  You'd only need 8 bits to implement the full (basic) ASCII character table.  You could use a lookup table to convert into PS2 scan codes.  That's where the memory crunch comes in on the N1. 

 

If you're really adventurous, you might design a conversion algorithm to convert the binary data to PS2 codes.  Not sure how that could be implemented.  A lookup table might be the easiest way to go.




#60958 Communicating to dac through netduino

Posted by Zoot on 13 December 2014 - 04:08 PM in Netduino Plus 2 (and Netduino Plus 1)

A little more information is in order before we can help...

 

1.  What voltage are you using for Vref?

2.  Where did you get the integer 1228 from?  Is it calculated from the equation Vout = Vref * (D/4096)?

3.  byte [] registerValues is never used in the code snippet.  Is it used somewhere else?  If so, can you post the rest of the code?




#58940 Netduino 1 internet/PC connection

Posted by Zoot on 28 June 2014 - 05:03 PM in Netduino 2 (and Netduino 1)

Yes, you can do something like that.  The Visual studio programming environment also lets you write Windows programs, so you could write a program with a button in it using C# (the same language that the Netduino uses).  You would need to use the serial port on the PC (if you have one), or else an Ethernet connection to talk to the Netduino.  To use Ethernet, you will need an Ethernet shield for the Netduino 1 so that it can talk to the Internet, or just between the PC and the Netduino.  The Netduino 1 doesn't natively support Ethernet without some extra hardware.

 

The serial port is a little easier, because there is no special hardware involved (actually, to use a native serial port on a PC, you would need a serial shield, or some sort of translator to change the voltage levels from the serial port to something that the Netduino can handle.  So there would be hardware involved to use the serial port), other than a serial port on the PC.  The easiest way to use a serial port is to use an FTDI USB to serial cable to talk to the Netduino.  The only tricky part is having a Windows program use the serial port.  There are serial classes for C# in Windows that you can use, and you can find plenty of examples on the web on how to use these classes to communicate with your projects.

 

Things to search for on the 'net:

 

"Using a serial port in C#"

"C# serial port"

"C# Ethernet"

"FTDI USB to serial cable"

 

This is a good start:

http://msdn.microsof...serialport.aspx

 

http://stackoverflow...port-in-c-sharp

 

 

A little research and some programming, and you'll have LEDs blinking to Windows button presses in no time.  Check out some of the information and post back.  Once you understand a little more, you'll have a clearer idea of where you need to go, and we can help you get there. :)




#58511 Serial TTL LCD

Posted by Zoot on 02 June 2014 - 12:45 AM in Netduino 2 (and Netduino 1)

Welcome to the forums and congrats on the Netduino purchase.  I don't have time to adapt the code for you (and you won't learn that way, anyway), but I'll try to give you some pointers in the form of pseudo-code:

 

1. For C#, you need to use a namespace and a main class for your program. 

2. There is no "Setup" function like there is on the Arduino.  You need to use methods to define all of the functions that you want to use.

 

Here is a pseudo-code example:

namespace serialLCD     // The namespace
{
     public class LCD     // The class
     {
          public LCD()     // The class constructor
          {
                initSerial();     // Call the initialization code for the serial port
                initLCD();       // Call the initialization code for the LCD
          }

          private void initSerial()
          {
               // Initialization code for the serial port goes here
           }

           private void initLCD()
           {
                // set the size of the display if it isn't 16x2 (you only have to do this once)
                // This is the Arduino code and won't work.  This is here to show you what needs to be done in this method.
                //  The Netduino code will be different

                lcd.write(0xFE);
                lcd.write(0xD1);
                lcd.write(16); // 16 columns
                lcd.write(2); // 2 rows
                delay(10); 
              }

// More methods needed here for brightness, contrast, etc.  You also have to have a main method for the program to call all of this stuff.

If you're serious about learning C#, I recommend a book called "Essential C#" by Mark Michaelis.  It's a fantastic book, and it's one of the only resources you'll ever need for the C# language.

 

I'm sorry that I don't have time to adapt the code for you and show you how it's done, but I can certainly answer any question that you pose in this thread.

 

Hope I helped a little...




#57788 Has anyone successfully used a HS1101 humidity sensor?

Posted by Zoot on 27 April 2014 - 03:51 PM in Netduino 2 (and Netduino 1)

Thanks CW2, that worked great.  A change of pins and a new coefficiant and I'm good to go.

 

Thanks again! :)




#57781 Has anyone successfully used a HS1101 humidity sensor?

Posted by Zoot on 27 April 2014 - 02:48 AM in Netduino 2 (and Netduino 1)

I'm building a weather logger and I'm having trouble with the humidity sensor.  It works with an Arduino, but not with my Netduino.

 

Basically, it's a capacitive sensor, so you have to set the CPU pin to an output and set it high, wait a second, and then set it low.  You then read the pin to measure the voltage decay in the circuit.

 

The Arduino code looks like this:

long RCtime(int sensPin)
{
	long result = 0;
	pinMode(sensPin, OUTPUT);       // make pin OUTPUT
	digitalWrite(sensPin, HIGH);    // make pin HIGH to discharge capacitor - study the schematic
	delay(1);                       // wait a  ms to make sure cap is discharged

	pinMode(sensPin, INPUT);        // turn pin into an input and time till pin goes low
	digitalWrite(sensPin, LOW);     // turn pullups off - or it won't work
	while(digitalRead(sensPin))
	{    // wait for pin to go low
		result++;
	}

	return result;                   // report results   
}

Like I said, it works fine with an Arduino.

 

This is my testing code for the Netduino:

double result = 0;
OutputPort RCTime = new OutputPort(Cpu.Pin.GPIO_Pin1, false);
RCTime.Write(true);
Thread.Sleep(1000);
RCTime.Write(false);
//InputPort Rtime = new InputPort(Cpu.Pin.GPIO_Pin1, false, Port.ResistorMode.Disabled);
            
            
            
while (RCTime.Read())
{
    result++;
}

result = ((result * 1.3181042) / 10);
Debug.Print("Humidity: " + result + " %");

Using the InputPort function after using OutputPort throws an exception, so I'm just reading the OutputPort.  Unfortunately, pullup resistors have to be disabled for this to work, and InputPort has no write method.  I think the Netduino code is relativiely similar to the Arduino code, but I'm doing something worng.

 

Any thoughts would be appreciated.

 

Thank you.




#57483 Multiplexing I2C?

Posted by Zoot on 11 April 2014 - 04:47 PM in General Discussion

Thanks for the link.  Just what I was looking for.




#57354 Multiplexing I2C?

Posted by Zoot on 05 April 2014 - 02:29 PM in General Discussion

AFAIK, the devices don't have the same address.  I'm a little new to I2C.  Are there any tutorials that you can recommend so that I can get a better understanding of it? 




#57348 Bezels for Cases?

Posted by Zoot on 05 April 2014 - 02:56 AM in General Discussion

Digi-Key also has an assortment of LCD bezels.  Various sizes, different mounting methods, etc.




#57347 Multiplexing I2C?

Posted by Zoot on 05 April 2014 - 02:51 AM in General Discussion

I'm hoping that someone can help...

 

I'm making a small weather logger, using a humidity sensor, real time clock, barometer and a temperature sensor all built on an Arduino shield, fitted with an SD card.

 

The problem that I'm having is that the RTC (DS1307) and the barometer chip (BM085) both use I2C.  I've searched the forum for a way to have these two items share the I2C bus, but haven't found anything.  I'm not sure it's even possible.  Would a better solution be to hardware multiplex with an external logic chip?

 

I'd much rather do it in code if I can due to limited space on the shield.  Any ideas?





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.