• Hello all,

    Long time forum skulker, first time speaker. I'm writing in the hope that people might be able to tell me how viable a concept I'm working on is, and if possible, make some suggestions as to better solutions.

    The company I'm working for needs to take an audit of temperatures in their warehouse for certain produce. From what scant details I can gather, this doesn't need to be a regular thing - they expect to pull out a graph every quarter or so.

    The solution that I'm planning on building would be approximately 5 espruino boards with NRF24L01+ modules and DS18B20 temperature sensors attached. They will sit in deep sleep mode, turning on every 15 minutes to take a reading, transmit and return to deep sleep mode upon a successful transmit, sleeping for 15 minutes minus time taken for transmission. I would ideally want these to be battery powered, hence the deep sleep and sparse readings, and plan on using the recommended 1400mAh Lithium Polymer battery. I've had people voice concerns about range for the aformentioned radio transmitters, I would hope to eek out about 50m for very small and infrequent packets of data.

    So far, so normal. However, this is where I'm at a slight sticking point - I want to have a Raspberry Pi handling the receiving and processing. (Ideally, this will be happily sat plugged into a wall socket for power). What I would want to do is implement a MySQL database on the Pi, with a web frontend for accessing the data (with the potential for adding a dashboard ala Brian Dorey.com's excellent solar data logger and e-mail notifications should the temperature fall outside of acceptable bounds).

    The reason I feel that I'm coming a little unstuck is the Pi - if I implement Espruino on it, I don't believe that I'll be able to implement the database, which is a fairly large sticking point. However, if I don't, I'm not sure if that will make communication between the radio modules a faff.

    If anyone has knowledge on these matters, any guidance would be greatly appreciated.

    Kind regards,

    MetallixBrother

  • Hi,

    Sounds like a great idea, and battery life should be absolutely fine.

    As far as range, the NRF24 modules don't seem to be fantastic - you might get 50m in open air (2.4ghz doesn't like walls that much), but even that might be a stretch. You can get modules with a proper aerial that should work a lot better, but I haven't tried them so can't really comment.

    The other radio options that come to mind are:

    • RFM12B 868Mhz modules - I haven't written any JS to drive these yet, but I have some in the desk beside me and I'd be happy to give it a go or to help out. There are some other types of 'RFM' modules too, and there are a few called 'LORA' which is very long range (kilometers) that could be worth a look.
    • Ciseco's SRF/XRF modules. These seem to have a relatively good range (they quote 500m), and they connect up with a simple serial port - so you're not really going to need anything much in the way of a driver. They do provide a special Raspberry Pi Shield (and they've even just made a KickStarter for a complete, boxed, Pi-based system).
    • You could also use something like the 433Mhz modules. The lower frequency of these would probably carry better, and while not 100% reliable, you'd just transmit the same data a few times and filter it out with the Pi. I'm not totally sure about the voltage needed for transmission with most modules though. They may not run at full power off a 3.7v LiPo.

    In terms of the Pi connection, I guess you have a few options as well:

    • Run the Espruino software on the Pi, and have it send an HTTP POST with data to the MYSQL/Web stuff that you've developed in your favourite language.
    • Actually connect an Espruino Board to the Pi, and then grab data from it via the serial port. There are some examples of scripts here, or you can use node.js or pretty much any language to talk to Espruino via USB Serial. It could be as simple as just listening for the characters that the Espruino prints when it receives something.
    • You could write software in your favourite language to talk directly to the radio module from the Pi. This would be more painful for a lot of radio types (although I'm sure there's example code for many of them), but as the Ciseco radios use the serial port so they should be trivial.

    I guess my suggestion would be to go the Ciseco route, to buy one of their 'Pi Hats' for the Pi, and use some of their example code to develop the Pi side of things. Their ERF module would fit onto the Espruino board pretty easily too.

    Ciseco have a comparison chart and it looks like the ERF doesn't do sleep mode. However you could just turn the whole thing on and off as needed with a transistor/FET.

    Hope that helps!

  • Hi Gordon,

    Thank you, that was exactly what I needed! I'll be sure to keep any progress posted :)

  • From what scant details I can gather, this doesn't need to be a regular thing - they expect to pull out a graph every quarter or so.

    What about a small SD card in Espruino and write to it (in csv format, for example)? Since it is not an online need, collecting the devices, pull the SD cards an read the data into a spreadsheet (column/row), and create the graph this way?

  • Hi allObjects,

    Whilst this would be the simplest option by far, my hope is to automate the system as much as possible - going round to various parts of the warehouse and collecting SD cards is going to be seen as a much larger hassle than taking data from a web interface. I'm particularly keen on avoiding physical collection as the other option the company is considering is this thermometer data logger, which is £60 excl. VAT, requires a £44 (excl. VAT) device to plug into a computer, and uses its own specialist software which would require training. As you can see, rather eager to avoid that sort of solution!

    Nonetheless, the input is much appreciated :)

  • MetallixBrother a few questions about warehouse is chilled and is full of metal racking?
    Looks like your in the UK so a RF module in the 868 mhz band would be my choice (http://www.lprs.co.uk/). You can use 433 mhz but that can have issues for ham radio & others RF channels. As I'm sure you know lower frequency better the range in buildings.

    Also look for modules that provide RSSI (Receive signal strength Indication) in their API. This will let you know how well you are connected to your temp sensors and log battery voltage. Both of these will help you run a robust wireless sensor network

    As for your Raspberry PI solution, that's exactly what I use but run Nodred.org as it has all I need. I've just started using it with Espruino.

  • Observing what is going with radio or wifi and its limitation and impact of the environment, I could see a combination of local storage AND radio and wifi. Local non-volatile storage provides the reliability of continuous data collection, and radio or wifi the periodic pick-up.

    I'm sure you observe(d) the growth of smart metering - networking of the utility meters for gas, power, and water - in residential areas, where one device communicates with the next etc. and the one closest to the 'access point' feeds the data of all it into the collection network.

    If the distances become to far between individual locations, you could even put in relays in between... same device (with or without temperature sensor)... and have a simplified logistics... The intelligence on the board can monitor power state and communicate '(battery) exchange' request.

    Having one device within the network wifi enabled, and this device running a web server, you can directly connect any LAN/WAN connected device...

  • Is there working WiFi in this warehouse? If so, I'd use that for reporting. If not, or if it's not reliable enough, I guess you're back to using some sort of RF comms.

  • Currently, there's no WiFi implementation in the warehouse. I'd definitely considered that as an option, but the main issue is that the power consumption seems to be quite large, from what I've seen. On top of this, WiFi is mostly being implemented in the warehouse for a picking system, so I imagine that that frequency will probably become quite crowded rather quickly.

    Obviously, whilst I would want to run some sort of mesh network (either RF or WiFi) this isn't practical with either system when power consumption is a major concern, as I can't afford to leave the transceivers running indefinitely without the batteries going flat in a number of hours. I suppose that I could possibly have the thermometers located remotely with some permanently powered relays, but that will drive the cost up quickly, as well as making the system a lot more complicated to maintain (I should note that I am only on a limited contract with the company, but they have several web and C# developers on site who make up the majority of the IT team - hence the main attraction to a JavaScript interpreter).

    LawrenceG, the warehouse isn't chilled, but it is filled with metal racking.

    allObjects, you've a fair point - I'd not considered that. Depending on the cost of SD cards, I might float that idea as a failsafe, but my concern is that it will drive the price above the aforementioned data logger.

  • I would suggest Bluetooth serial module Class 1 which is 100 meter free air range and to be switched on by the Espruino module when time to send the log.
    It is easy to communicat as it is serial RX TX communication most of the ones on ebay are 10m range class 2 and the class 1 on ebay has RS232 level conversion which consumes power so there must be a supplier who sells bare module with ttl RX/TX.
    As for the recieving machin you could go for Android tablet, windows system or Linux .
    good luck

  • @MetallixBrother your right a mesh wouldn't last long I've found this tool useful for rule of thumb battery calks http://oregonembedded.com/batterycalc.ht­m

    You probably want to consider a site survey with your chosen hardware to make sure your getting the range you expect. I've learn't this the hard way even after doing a full paper based survey (using a floor plan) to identify poor signal paths.

  • Hi all,

    Thank you again for your suggestions, they've been very helpful :)

    I probably ought to have mentioned this before, but this is my first real foray into electrical engineering (primary focus is as a web developer), so this is still all very shiny, new (and a little petrifying!) to me.

    @Gordon, your suggestion of Ciseco modules (particularly ERF/Slice of Radio) sounds really appealing. If I might trouble you for some help, I've a couple of queries;

    1. Whilst I've reviewed the site's information on MOSFETs, I'm afraid
      that I don't know how I could use them in relation to the Espruino's
      internal clock for switching serial on and off. Do you know of any
      resources you could particularly recommend for this?
    2. The chip antenna is certainly respectable for range, it does seem to
      suggest that a wire whip antenna could get that 500m range (300m for
      Slice of Radio). However, I've been going completely spare trying to
      find anywhere that sells simple 82.2mm wire whip antenna that will
      interface with the board - do you or anyone else know where these
      can be purchased from, or am I missing a trick?

    My apologies if I do seem a little slow on the uptake on this, and again, everyone's help has been nothing short of amazing :)

  • No problem :)

    1

    Actually I'd probably suggest using a PNP transistor. You should be able to use pretty much anything adafruit suggest a PN2907 as a general purpose one. Then get 2x 1kOhm resistors, and connect:

    • A resistor from the base to one of Espruino's spare IOs
    • A resistor from the base to the emitter (this is optional, but it's probably good to have it)
    • The emitter to 3.3v (I think that's what is needed to power the ERF?)
    • The collector to the ERF modules voltage input

    Then the software's just:

    var PWR = pin_connected_to_transistor;
    function sendReading() {
      digitalWrite(PWR,0); // power on
      setTimeout(function() { // wait for radio to start
        Serial2.print("my data");
        setTimeout(function() { // wait for radio to finish
           digitalRead(PWR); // Make PWR an input -> power off
        }, 500);
      }, 500); 
    }
    
    setInterval(sendReading, 1000*60*15); // 15 mins
    

    2

    I don't know of anywhere offhand, however so far I've just cut a piece of solid core wire of the right length and soldered it on. It seems to work ok.

    If you need it smaller you might be able to wrap it around a pencil to make it spring-shaped, but I'm not a radio engineer so I don't know if that's good or bad :)

  • as well as making the system a lot more complicated to maintain (I should note that I am only on a limited contract with the company, but they have several web and C# developers on site who make up the majority of the IT team - hence the main attraction to a JavaScript interpreter).

    Good point... this is not just because of physical operation and software maintenance/lifecycle, but also for getting the hardware together and maintained... There are many simple ways to do things, for example add some power transistor to switch on and off any extra devices in the system beyond the main board, but it becomes challenging when having to get a replacement or a new node.

    Because of the cost concern for using SD cards in the mix, I thought of just soldering an spi EEPROM/FRAM/MRAM to the board. Cost may be met that way, but maintenance would require more than what a Web (JS,C#) programmer profile includes.

    This real-world use case sheds some light on what kind of shields would be useful... and I was thinking Espruion Pico shields!

    To meet the requirements of this real-world use case a shield - or smart combination of shields - would have to provide:

    • communication (long range, low power, periodic,...)
    • power conversion/step-up - for RF and other things (many RF things just need more than 3V to get you somewhere - as other forum users experienced w/, for example, 315/433 MHz, cheap/simple devices. Alternatives: see LoRa(TM) - Ultimate Long Range Solutions).
    • storage for fail safe (until communication is available again or time is ready to process received data
    • power switch(es) beyond the current what a chip pin can deliver (could be combined with power conversion

    @MetallixBrother, what type of Espruino board are you considering? A) Espruino standard (1.4)? - or B) Espruino Pico?

    #shield #pico

  • If you did want to store on something nonvolatile, I'd strongly suggest you just save yourself a whole load of pain and use a normal Espruino board with a Micro SD card. Looks like they can be had for just £2, if not less. Which is probably cheaper than you can get EEPROM/FRAM/MRAM.

    However if you've got it running off a battery you could still store well over 1000 temperature readings in RAM, so I'm not sure that's such a big deal.

  • Regarding power consumption, take a look at low power data logger/storage.

    Looking at the figures, you may even run the power of the SD Card from a Espruino pin, which lets you keep the battery smaller.

  • I would support @allObjects in recommending LoRa.
    Even with cheap Chinese modules I've got 350 Meters from my home in a residential area. Indoors I can't find a place where it won't work :)

    These modules are popular http://www.hoperf.co.uk/shop/RFM92W-868S­2-RFM92W_868S2.html BTW if your considering this module for commercial projects I've been told it will fail EMF testing.

  • There's some Whisker IoT LoRa module that claims to have better shielding than the hopeRF one - but is pricier, and I'm not sure if it's shipping yet (they ran a KS a few months ago). It also has additional firmware layered onto it, which may be good or bad. I didn't read much about it, but google will find.

  • Whisker aren't shipping 868 mhz yet and modules are undergoing CE testing. Like number of module manufacturers they have a simple AT command interface.

    http://modtronix.com/inair9.html will do an 868 mhz they are more maker focused but you will need to implement the LoRa HAL (Hardware Abstraction Layer). May be something for Gordon :)

    All the EU module manufacturers are commercially orientated. Some you have to buy their dev kits or they have MOQ in 100/1000s off.

  • Have you considered buying Oregon Scientific or similar transmitters and just implementing the receiver on the Raspberry Pi?

    Receiver Library is available on GitHub https://github.com/daveblackuk/RPI_Orega­n
    Just be careful not all transmitters use the same protocoll.

  • @AntiCat that's a good thought actually. If you just want temperature (and nothing else) then those might be interesting (and cheaper).

    I've also done some JavaScript for a 433Mhz reciever website that uses line in of a normal PC (or an Android device), although if you have a Pi it'd be easier to plug it in direct.

    You can actually install Espruino itself on the Pi and use that to receive Radio signals in the same way. It's not fast enough to decode many different types of device, but I have tried decoding a single 433Mhz protocol that way and it works great.

  • Hmm. Definitely very interesting prospect @AntiCat I'll have to see if I can implement some relays/mesh network given the range on the THN132N comes in at a pretty meager 30m in clear conditions.

  • @Gordon most sensors measure temperature and humidity (the accuracy of the humidity sensor is however debatable)

    @MetallixBrother Yes range is a problem... if you still have to apply additional nodes as repeaters the advantage of using prebuilt temperature and humidity transmiters is little.

    Sidenote:
    I tried two different receivers in for my project, the cheap MX-05V
    http://www.ebay.com/itm/433Mhz-RF-transm­itter-and-receiver-kit-for-Arduino-ARM-M­CU-WL-/261041100836?pt=LH_DefaultDomain_­0&hash=item3cc7431824

    and the little more expensive RXB6 once.
    http://www.ebay.com/itm/271638472090?_tr­ksid=p2060778.m2749.l2649&ssPageName=STR­K%3AMEBIDX%3AIT

    The 2nd type had way better reception quality in my tests.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Seeking advice on the feasibility of a project concept

Posted by Avatar for MetallixBrother @MetallixBrother

Actions