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.

Nobby's Content

There have been 66 items by Nobby (Search limited from 29-March 23)


By content type

See this member's


Sort by                Order  

#39788 HTTPS support on N+2?

Posted by Nobby on 21 November 2012 - 06:41 AM in Netduino Plus 2 (and Netduino Plus 1)

I was about to start prototyping code in my existing product to use SSL for client authentication. Haven't written I line of code yet but I've read through the framework API for supported functionality. http://msdn.microsof...y/hh401316.aspx is where most of what you need can be read. I'm not sure if this component of the .Net Microframework is part of the build for Netduinos.

The basic run-down is that your device can be a client or a server as far as SSL is concerned so technically you can pull off HTTPs. If you're using basic HTTPS then you only need to store one or two certificates. One to certify your netduino as a secure server and possibly another certificate/cert chain that points to a publicly trusted certification authority(CA). If you don't care about the certificate being trusted and you just want secure communications it's pretty simple.

  • Generate and store the SSL certificate for your netduino into RAM at run-time via the CertificateStore class. Put the cert on an SD card and read it off each time you boot up
  • Use the SSLStream class for reading and writing data instead of a NetworkStream with the client socket.
  • Server authentication via the netduino certificate is mandatory but client authentication with a separate certificate is optional. Use the SSLStream.AuthenticateAsClient and AuthenticateAsServer functions.
  • Once authenticated, you use the streams like normal HTTP



#39296 Connecting a motor to the netduino

Posted by Nobby on 13 November 2012 - 10:19 PM in General Discussion

You've got two goals to achieve here. Your circuit build/hook-up and software to control the H-Bridge. The good news is that regardless of how you end up controlling the H-Bridge, the connections are the same.


You haven't specified what your H-Bridge is and how it's been put together etc. They're simple systems to understand. You need to connect at least three different kinds of connections:


  • DC Bus link voltage. This is the power supply you provide the H-Bridge. It can be bi-polar or uni-polar but it depends on if your H-bridge will allow you to connect a 'center-tap' for setting the ground as a mid-point.
  • CMOS/IGBT gate inputs. You connect your PWM outputs to these. There are four of them but they are in pairs so you only need two PWMs to drive it. One switch is always off when the other is on for each pair(side note on this)
  • H-Bridge output goes to the motor. You will be able to drive a DC or an AC motor with an H-bridge.

There may be some other component considerations depending on the gear you've bought.

Controlling the motor can be as easy or difficult as you want and it's a massive field for you to explore. To start with, you will most likely be able to get a library or use .Net classes which will operate the PWMs for you. Because you have an H-Bridge you have two options:


  • Use one PWM on half of the H-Bridge as a starting point. It turns your H-Bridge into a single phase-leg modulator which means you can't drive an AC motor
  • Use two PWMs on the full H-bridge which will allow you to drive an AC motor as well as DC

Above is your starting point but it has no feedback control loop. Without feedback from the motor, you won't be able to know how fast it is actually spinning for a given input signal. If it's important for you to have precise control of the motor speed, you need software in your project which will measure the motor speed and figure out the difference in desired speed and actual speed the adjust your modulation depth to drive the H-bridge harder or less. Some motors can tell you their position as well so you can precisely control the position of the motor as well as speed.

Having said all this, if you're just a hobbyist and want to see the motor spin, you don't need a feedback control system or understand much about modulation theory. If you told us more about your goals then we can be very specific about helping you to setup the right system.



--edit: oops forgot the side note. Depending on how your H-bridge has been designed, you have to build a "dead-zone" into the PWM signal. If there's free-wheeling diodes and/or your H-bridge uses IGBTs, there's a discharge transient when the device attempts to switch off. If you toggle the other switch on before its complimentry switch has fully turned off, you create a short on your power supply every time the PWM switches on/off. It will damage your supply and possibly much more.



#39290 Anyone try driving a relay with two output pins.

Posted by Nobby on 13 November 2012 - 09:48 PM in General Discussion

If I'm using a dual coil latching relay with voltage of 3V (with coil resistance 129 ohms), do I need to use the transistor ??


It's a bit touch & go with your situation. When they say 129 ohms, they mean total impedance. Part of it is reactive and the other is purely resistive. 129ohms at 3.3V from the CPU pin will draw up to 23mA which is borderline. If you intend on driving the relay in short bursts then it would possibly be acceptable but otherwise you wouldn't.

Once the transient behaviour dies away from switching the relay on, the effective impedance of the relay will be less and you'll exceed the maximum continuous current draw from the CPU pin and smoke the poor thing.

If it was me, I'd use a transistor.



#39225 Alternative Purchasing Options for Netduinos

Posted by Nobby on 12 November 2012 - 11:39 PM in General Discussion

I have used only Nwazet and Proto-advantage for all my stuff, both give you cheap delivery, and reasonable fast shipping.
I'm always taxed on those purchases though, since Norway have this stupid customlimit, if it cost above 200NOK (about $32) I have to pay 25% on everything including shipping.

When I bought an Arduino now, I tried to buy from the italy shop, kinda, to support buying from correct place, but they did not trust the postal system, so they required me to use an $77 UPS shipping. So, of course I bought it from Adafruit instead, which sold me the unit at proper price, and $9 in shipping :)
Most of my electronic stuff is coming from the two above, pluss ebay, and adafruit.


I feel your pain. My country has horrible software tariffs with the USA. Our currency is stronger than theirs but my MSDN subscription costs me nearly twice as much as a US subscriber. I don't even order DVDs, just download everything.



#39131 Alternative Purchasing Options for Netduinos

Posted by Nobby on 12 November 2012 - 06:35 AM in General Discussion

Hi Nobby,

Which region do you live in? Also, sorry to hear about your bad experience. Is it a Netduino-reseller? If so, it may be good to know for Secret Labs which reseller.



I'd prefer not to put the particulars of the issue on the forum. Is there an appropriate email contact at Secret Labs I could shoot my email off to?



#39125 Alternative Purchasing Options for Netduinos

Posted by Nobby on 12 November 2012 - 05:27 AM in General Discussion

I understand this might be a difficult ask because of how taxes and tariffs work in various countries but I was looking at being able to purchase Netduinos from overseas. There's only one reseller in my region and they have recently been 'less than helpful' with the loss of and expensive package. I would prefer not to do business with them anymore if possible and I'm a month or two away from a green light to purchase a commercial quantity of Netduinos for a client's project. I've tried using Amazon and a few other resellers and they have international shipment policies in place to prevent purchases for whatever reasons/structures you have in place with your distribution network. This has probably been asked in a few threads but have Netduino Plus 2's been shipped to most international resellers? I would be looking at moving my product's hardware platform from Netduino Plus to Netduino Plus 2 and would like to do an evaluation before buying a bunch.



#38804 Netduino Stops when switching relay through transistor

Posted by Nobby on 09 November 2012 - 01:03 AM in General Discussion

Hi!

Thanks for help! Finally I found the problem with Nobby's tip. I changed the base resistance from 1k to 6k and it works now in every variations. However I don't understant totally because I think that the relay's inner resistance limits the current to 70mA. So I don't know why is it a problem if the transistor's gain is too high. By the way I use a BC327-40. As I checked the datasheets its gain is above 250.

Now it works, so thank you!



Awesome work!!


250 gain is pretty high for low power circuits and 6k would be a lot better than 47k in your case. When you design in the future, transistor parameters are important. High gain will usually mean a higher forward-bias base current and larger voltage drop from base to emitter which means you'll choose a smaller base resistance etc.


As for the relay, devices like that don't have the capability to regulate/limit current unless they switch off from over-current(built in protection) so it's important to do power calculations for your transistor circuits. The current in simple circuits like this are always determined by the voltage level of your power source (i.e. 5V) and the total resistance/impedance of the circuit path the current is travelling along. If you follow those fundamental rules in design then your systems will function predictably and safely.



#38705 Something new is brewing in the Secret Labs

Posted by Nobby on 08 November 2012 - 06:04 AM in General Discussion

Just noticed that the Netduino Plus forum got renamed so I'm putting my money on a second generation Netduino Plus :)



#38704 Visual Studio 2012 & Netduino Projects

Posted by Nobby on 08 November 2012 - 06:00 AM in General Discussion

With the release of the .Net MF 4.3 Beta, we've all had the pleasure of Netduino development under VS2012. Since there isn't a Netduino SDK for 2012 yet, you can't make new Netduino, Netduino+ etc projects under VS2012. Are there registry hacks which are fairly painless to create Netduino project templates for VS2012?



#38703 High Resolution Quad Encoder Problem

Posted by Nobby on 08 November 2012 - 05:54 AM in General Discussion

Well, I understand the concept and I dont have a problem writing the code for say a 2.4GHz processor x86 with a 4 GBs of ram sampling time of around 1e-6 second easily, the problem I had over here was using this high resolution encoder with a netduino thats all. Just to put things in perspective, if the shaft is rotating at 3 revs/second (180 rpm which is not much )thats 1200*3 = 3600 interrupts/second. I just need help on generating an efficient enough code for the netduino to be able to handle all that along side of some computation thats all. Like I said I am just not used to micro-framework.


There's a couple of ways you can deal with your scenario. If your PID controller is for speed only then the only problem you'll face is convergence speed and possible overshoot depending on your performance specification. Even if the interrupt frequency basically matches the transport delay of the netduino hardware/framework, you just design your PID outer control loop as fast as the device can.

Position control for 3600 interrupts/sec is going to be hard. Depending on how smooth the control needs to be, you would probably have to slow the motor down. If you have to maintain a particular speed range then you'll most likely have jerky position control from lack of controller bandwidth and transport delay.

Although the netduino is capable of 100ns precision timing, most timing functions have 1ms precision. Do you have an option of a lower resolution encoder or do you need to have ridiculously fine position control?



#38532 Netduino Stops when switching relay through transistor

Posted by Nobby on 05 November 2012 - 06:09 AM in General Discussion

As CW2 mentioned, a short could be occuring. Do you have a series resistance on the transistor collector or emitter? Another cause could be your base resistance. 1kOhm is too small. Assuming you don't use an emitter-follower BJT configuration, the base current into your BJT is 3.3V/1kOhm = 3.3mA. This current might seem small but BJTs have a current gain of at least 50 for common BJTs. When your control pin goes high, the BJT will try to draw 165mA from the 5V regulator. When you try to pull too much current from a supply, the voltage of the supply will dip and cause a reset of the Netduino. You should find out what the gain of your transistors are and calculate the base resistance to work well with your relay. For example, you need about 60mA to operate the relay and your BJT has a gain of 100. The base resistance needs to be in the ball-park figure of 55kOhms. Actual(peferred) values you can buy close to that at 56k and 47k. 56k will give you less than 60mA so I'd choose 47k in this case. For saftey, you probably have or should have a series resistor connected to the BJT collector or the emitter. If you drive a BJT hard enough, it's collector-emitter voltage can go down to 0.3V. If you don't have the series resister in there, you can virtually short the 5V rail and cause the Netduino to reset and possibly damage the board. Since your relay runs on 5V, you have to have a small series resistance so that the drop across it when you draw 60mA is small. Secondly, you don't need the anti-parallel diode since it's only for dealing with protection against negative voltages.



#38284 Tenda 3G611R+ 3G router issues

Posted by Nobby on 31 October 2012 - 09:19 AM in Netduino Plus 2 (and Netduino Plus 1)

Does the call to s.Send() block indefinitely or does an exception get thrown? It's odd that the router permits the outbound socket connection but not the underlying data. I'm 50/50 about Tenda. I've bought quite a few different products of theirs. I use a 16 port gigabit switch at home but I've bought wireless gear as well in the past and thrown it in the bin out of frustration.



#38212 How to check if ethernet is connected?

Posted by Nobby on 30 October 2012 - 12:45 AM in Netduino Plus 2 (and Netduino Plus 1)

One method I use is to create a socket which is a listener using IPAddress.Any for the binding. The listener will be created if the network is up or down but you can call Socket.Poll(). It will throw a SocketException if the network is down with an error code 10050. The only time this approach fails is if you power the ND+ up and it initially isn't connected to the switch/router. There's some bug which is apparently being fixed in 4.3 where network connectivity to the ND+ is impossible under this start-up condition but the ND+ internally believes connectivity is fine after you plug the network cable in.



#38211 Wireless contact switch

Posted by Nobby on 30 October 2012 - 12:31 AM in General Discussion

There's no protocols(in the traditional sense) or encryption with devices like this. They're brutally simple. The three key bits of info there are carrier freq, freq tolerance and modulation type. The modulation type is ASK. Ideally you'd use an ASK demodulator with a center frequency of 319.5MHz(the carrier freq) which will give you the analog envelope as an output. You then process the signal here which could be nasty. The device obviously transmits a serial/unqiue ID number but the PDF indicates that you need to hook it up to an ITI security panel(whatever that is). You'd be hard-pressed getting the information to interpret the signals sent by the device but if you've got a good CRO/scope and a lot of time, you could figure it out.... or just find a generic product if they exist.



#38173 Out of Memory - Debug.GC(true) says I'm not?!

Posted by Nobby on 29 October 2012 - 11:21 AM in Netduino Plus 2 (and Netduino Plus 1)

I haven't done an investigation yet but I had memory issues when calling three lines of StreamWriter.WriteLine(long) to save three numbers to a config file on an SD card. My netduino would report at least 21kB free mem with GC(true) then the three calls to WriteLine(long) would spew out failures to assign blocks of various sizes in the visual studio debug window before crashing from OOM exception. All I changed in the code was calling long.ToString() on all the numbers before parsing the data to the stream writer. I'm using 4.2.



#38172 Getting Started with Netduino: Connecting to the Internet

Posted by Nobby on 29 October 2012 - 10:57 AM in Netduino Plus 2 (and Netduino Plus 1)

I have version 4.1 since this is what is recommended in the Download section of this site.



I tried all your suggestions and my browser still doesn't want to connect to the Netduino. I am running the example code from Chapter 8.



I really appreciate the it! Here is a screenshot of my current network settings in MFDeploy:


I noticed in your MFDeploy screenshot that your default gateway isn't in the same IP pool as the DHCP assigned IP address(192.168.5.XXX vs 192.168.1.XXX). Since you're using 24-bit networking, a lot of things are going to go south here. It also suggests that you might have some sort of configuration issue in the netduino or your router.

--Edit my bad: I saw that was your old static IP address.



#38170 Low Latency Wireless Comms

Posted by Nobby on 29 October 2012 - 10:39 AM in General Discussion

You're going to find that most wireless comms use a burst approach for data transfer. The hardware protocol will usually try to send a data burst of a minimum to maximum size and at deterministic intervals. This is because free-space(air) is an indeterministic transmission medium which causes time varying scew in the carrier and data(phase distortion) and all sorts of other nasties. It places a constraint on the continuous length of time you can transmit data before the probability of data error becomes too high. So essentially synchronised, continuous data streams between wireless devices is impossible without substantial overhead. There is also a fair amount of overhead for sending/receiving data in general, especially with multiple devices which places a constraint on optimal minimal packet size as well as burst interval. Having said all of this, it's still quite possible to achieve a ping of under 5ms. I have a wireless bridge in one of my outdoor systems which is line-of-sight and spans 400m with a ping of no more than 1ms. -It runs at 5GHz instead of the 2.45GHz band -The devices don't use a proprietary protocol -They have adjustable high-gain antennae and high base power level -Can operate at up to 75km appart Those are the kind of extents you have to go to in order to meet requirements. You're going to have to dodge 2.45GHz devices unless you know your operating environment is going to be well shielded from other terrestrial noise. If you live in america, they're laws permit 2-3 times the maximum broadcast power of 2.45GHz transmitters than a lot of other countries so your signal-to-noise ratio(SNR) can suffer a lot more increasing overall latency. Once you've got a decent wireless architecture then you can start looking at .Net runtime overheads etc etc.



#37413 PCF8574N inverted outputs?

Posted by Nobby on 19 October 2012 - 06:55 AM in General Discussion

You haven't made a mistake but have accidentally hooked it up the right way :) http://www.datasheet...o1rgkyk7ucy.pdf is the datasheet for the IC. If you go to page three you can see the circuit diagram for the output pins and the driver logic. There's two MOSFETs driving the output and they call that a totem-pole driver. With the way you've hooked it up, current flows from the 5V rail, down through the LED and resistor and then into the IC pin. The totem pole has bi-directional current flow capabilities and the current flows into the IC when the bottom MOSFET is switched on. Current flows through the MOSFET and then into GND(ground). The I/O register has an inverter which turns the MOSFET on when it's logic level is zero so that your software logic matches up with the circuit configuration. This is usually how you drive LEDs and 7 segment displays and the ICs are commonly refered to as the "sinks". Of course, you can hook it up so that current flows out of the IC, through the LED -> resistor -> GND by simply changing your circuit configuration. The switching logic levels will be opposite to how you have them already though.



#37294 Yet another diagnostic question

Posted by Nobby on 16 October 2012 - 11:43 PM in General Discussion

This is a similar thread to the one I posted earlier about free memory. This time I'm looking at writing thread-based diagnostics. Due to the Process class not being relevant for .Net MF, is there a way of getting a list or a count of threads that are in any possible state within the application domain or "process"? Secondly, if I have a stray, unreferenced thread floating around, does the GC gobble it up if it's in a non-idle state or when IsAlive is true?



#37263 Running out of memory

Posted by Nobby on 16 October 2012 - 04:31 AM in Netduino Plus 2 (and Netduino Plus 1)

Hey Patrick, this may or may not be of any use because it depends on the back-end code for sockets. With the regular .Net framework, socket objects can be disposed but underlying socket resources are maintained by the CLR in the event that in a short space of time, you decide to create a new socket to the same remote host on the same port. This is true even if you call dispose and try to trash the socket as hard as you can. When you use the 'using' clause, it just calls Dispose on the IDisposable object. Your network stream will dispose fine but your socket objects might be doing funny things if the implementation of System.Net.Socket is the same under MicroFramework as it is for regular framework. This is the only thing I can think of that hasn't been explored yet.



#37011 Runtime Memory Usage

Posted by Nobby on 11 October 2012 - 04:32 AM in General Discussion

Hi Nobby,

Try:
int freemem = Microsoft.SPOT.Debug.GC(...);

You can optionally pass in true, forcing a garbage collection, giving you the full amount of memory available.

Chris


That worked a treat, thanks Chris :o)



#36993 Runtime Memory Usage

Posted by Nobby on 10 October 2012 - 11:45 PM in General Discussion

Hey guys, Is there a method to check runtime memory usage and possibly get the total memory of the device through micro framework? With the regular .Net Framework you have to do it through a process object but this doesn't apply to .Net Microframework. I've had a skim through all the namespaces for 4.2 and can't find anything relevant.



#36842 .NET MF 4.3 beta

Posted by Nobby on 09 October 2012 - 10:30 AM in General Discussion

Was just about to go to bed and saw this thread. Downloaded the beta framework and installed. Two days ago I downloaded and installed the retail VS2012 Professional. Microframework applications in my solutions now load. I built a 4.2 netduino+ application, deployed and debugged, working fine so far. Will be putting this to a hard test over the next few days and hopefully will be able to do away with 2010.



#35267 Interfacing netduino with an alarm clock

Posted by Nobby on 15 September 2012 - 08:22 AM in General Discussion

Technically you can do this. The first problem I thought of that would make me abandon the project would be that setting the alarm time would be a pain in the butt. Changes to the time are always relative to the previous alarm time so unless your netduino knows the previous alarm time, it is impossible to set a new alarm time. Unless of course you reset the power to the clock before the alarm time is set. Unfortunately, you'd have to setup the clock time as well as the alarm time. Secondly, you might have rate and synchronisation issues. For example, you know that if you mash the buttons as fast as you can, the clock will only change the values so quickly. The clock circuitry most likely polls for button presses as well and it's likely that you will occasionally have an adjustment pulse missed and the time you set will be incorrect. These are problems that I came up with before even considering the rediculous amount of electrical interfacing you need to do with the clock. If you're doing it for fun or learning, I reckon it would be great but practically, it would be a nightmare.



#34469 Probelms In Sockets??

Posted by Nobby on 30 August 2012 - 10:28 PM in Netduino Plus 2 (and Netduino Plus 1)

The first thing to change on the PC end is your calls to Socket.Recieve(). Since you aren't specifying how much data to read on each call, it will try to read enough data to fill the array and will block until it does unless

  • You close the socket
  • Have a ReadTimeout value set on the socket

Either way, an exception will be thrown on the PC application. Make the buffer smaller to match the length of the data or provide an amount to read. In your case, the PC application will try to read 1000 bytes all-up.

On the Netduino side of things, I never simply use Socket.Send(). I always tell it was data range to use from the array so that I know I have full control over safe execution. This doesn't mean that the Netduino exception is being caused by this.




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.